This required a bit of refactoring to get the type of `STATUS` correct
for each suite.
There are two cases which I decided not to support in the type system:
- passing a list instead of a tuple when defining an option group
- `in` checks using a data type that doesn't match the choices
There used to be a [bug in Django](https://code.djangoproject.com/ticket/30427)
that caused these tests to fail, according to the discussion of #370.
That bug was fixed in Django 4.0.
However, because the test model was using a `FieldTracker`
rather than a `ModelTracker`, all model-specific test cases
in `ModelTrackerTests` continued to fail.
Besides requiring less code, this also allows the django-stubs
mypy plugin to automatically generate a type-annotated version
of the manager.
Unfortunately, the plugin does not put a `ClassVar` annotation
on `objects`, which is why we need the suppression.
Avoid using `Self` as a type argument: for some reason this fails
when mypy has an empty cache, but passes when the cache has been
filled. Maybe it's a weird interaction between the mypy core and
the django-stubs plugin?
* Pass additional arguments to superclass `contribute_to_class()`
In Django 3.2 there is an additional argument `private_only` and more
could be added in future versions.
This module was support code for the `SaveSignalHandlingModel` tests.
That class got introduced in 5d6f8f4e and removed in 11f3a53b, but
the support code remained.
There were two classes named `StatusCustomManager`: the first is an
actual manager, the second a status model that uses a custom manager.
The latter is renamed to `CustomManagerStatusModel` in this commit.
The decorator works without an argument as well, but that is an
undocumented feature of `unittest.skip()` that is not understood
by mypy and pytest.
In the case of pytest, it ignored the decorated class during test
collection, instead of collecting it and marking it as skipped.
There are small typos in:
- docs/managers.rst
- model_utils/managers.py
- tests/test_models/test_timestamped_model.py
Fixes:
- Should read `subclasses` rather than `subclasess`.
- Should read `queryset` rather than `querset`.
- Should read `permissible` rather than `permissable`.
- Should read `modified` rather than `modifed`.
- Should read `heterogeneous` rather than `heterogenous`.
Signed-off-by: Tim Gates <tim.gates@iress.com>