diff --git a/docs/conf.py b/docs/conf.py index 9150181b..7b185bc8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,9 +1,9 @@ import os import sys -sys.path.insert(0, os.path.abspath("..")) +from model_bakery import __about__ -from model_bakery import __about__ # noqa +sys.path.insert(0, os.path.abspath("..")) project = "Model Bakery" copyright = "2023, Rust Saiargaliev" diff --git a/model_bakery/random_gen.py b/model_bakery/random_gen.py index ce740623..a54516a6 100644 --- a/model_bakery/random_gen.py +++ b/model_bakery/random_gen.py @@ -27,7 +27,7 @@ # Postgres database. MAX_INT = 100000000000 -baker_random = Random() +baker_random = Random() # noqa: S311 def get_content_file(content: bytes, name: str) -> ContentFile: diff --git a/model_bakery/recipe.py b/model_bakery/recipe.py index 13058b7c..b302f96c 100644 --- a/model_bakery/recipe.py +++ b/model_bakery/recipe.py @@ -94,8 +94,7 @@ def make( _bulk_create: bool = False, _save_kwargs: Optional[Dict[str, Any]] = None, **attrs: Any, - ) -> M: - ... + ) -> M: ... @overload def make( @@ -108,8 +107,7 @@ def make( _bulk_create: bool = False, _save_kwargs: Optional[Dict[str, Any]] = None, **attrs: Any, - ) -> List[M]: - ... + ) -> List[M]: ... def make( self, @@ -146,8 +144,7 @@ def prepare( _save_related: bool = False, _using: str = "", **attrs: Any, - ) -> M: - ... + ) -> M: ... @overload def prepare( @@ -156,8 +153,7 @@ def prepare( _save_related: bool = False, _using: str = "", **attrs: Any, - ) -> List[M]: - ... + ) -> List[M]: ... def prepare( self, diff --git a/tests/generic/models.py b/tests/generic/models.py index 3bcf9d76..6bd6ba59 100755 --- a/tests/generic/models.py +++ b/tests/generic/models.py @@ -87,24 +87,17 @@ class Person(models.Model): occupation = models.CharField(max_length=10, choices=OCCUPATION_CHOICES) uuid = models.UUIDField(primary_key=False) name_hash = models.BinaryField(max_length=16) - days_since_last_login = models.BigIntegerField() + days_since_last_login = models.SmallIntegerField() + days_since_account_creation = models.BigIntegerField() duration_of_sleep = models.DurationField() email = models.EmailField() id_document = models.CharField(unique=True, max_length=10) - - try: - from django.db.models import JSONField - - data = JSONField() - except ImportError: - # Skip JSONField-related fields - pass + data = models.JSONField() try: from django.contrib.postgres.fields import ( ArrayField, HStoreField, - JSONField as PostgresJSONField, ) from django.contrib.postgres.fields.citext import ( CICharField, @@ -123,7 +116,6 @@ class Person(models.Model): if django.VERSION >= (4, 2): long_name = models.CharField() acquaintances = ArrayField(models.IntegerField()) - postgres_data = PostgresJSONField() hstore_data = HStoreField() ci_char = CICharField(max_length=30) ci_email = CIEmailField() diff --git a/tox.ini b/tox.ini index f4d9843f..c77ea10c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,8 @@ [tox] env_list = - py38-django{42}-{postgresql,sqlite} - py39-django{42}-{postgresql,sqlite} - py310-django{42,50}-{postgresql,sqlite} - py311-django{42,50}-{postgresql,sqlite} - py311-django{42,50}-{postgresql-psycopg3} - py312-django{42,50}-{postgresql-psycopg3} + py{38,39}-django{42}-{postgresql,sqlite} + py{310,311}-django{42,50}-{postgresql,sqlite} + py{311,312}-django{42,50}-{postgresql-psycopg3} [testenv] package = wheel