Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
barseghyanartur committed Dec 21, 2023
1 parent 7958e75 commit b5d441d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
30 changes: 15 additions & 15 deletions examples/sqlalchemy/article/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ def add_to_group(user: User, name: str) -> None:
class UserFactory(SQLAlchemyModelFactory):
"""User factory."""

username = FACTORY.username() # mypy: ignore
first_name = FACTORY.first_name() # mypy: ignore
last_name = FACTORY.last_name() # mypy: ignore
email = FACTORY.email() # mypy: ignore
date_joined = FACTORY.date_time() # mypy: ignore
last_login = FACTORY.date_time() # mypy: ignore
username = FACTORY.username() # type: ignore
first_name = FACTORY.first_name() # type: ignore
last_name = FACTORY.last_name() # type: ignore
email = FACTORY.email() # type: ignore
date_joined = FACTORY.date_time() # type: ignore
last_login = FACTORY.date_time() # type: ignore
is_superuser = False
is_staff = False
is_active = FACTORY.pybool() # mypy: ignore
is_active = FACTORY.pybool() # type: ignore
password = PreSave(set_password, password="test1234") # type: ignore
group = PostSave(add_to_group, name="TestGroup1234") # type: ignore

Expand Down Expand Up @@ -109,14 +109,14 @@ def _post_save_method(self, instance):
class ArticleFactory(SQLAlchemyModelFactory):
"""Article factory."""

title = FACTORY.sentence() # mypy: ignore
slug = FACTORY.slug() # mypy: ignore
content = FACTORY.text() # mypy: ignore
image = FACTORY.png_file(storage=STORAGE) # mypy: ignore
pub_date = FACTORY.date() # mypy: ignore
safe_for_work = FACTORY.pybool() # mypy: ignore
minutes_to_read = FACTORY.pyint(min_value=1, max_value=10) # mypy: ignore
author = SubFactory(UserFactory) # mypy: ignore
title = FACTORY.sentence() # type: ignore
slug = FACTORY.slug() # type: ignore
content = FACTORY.text() # type: ignore
image = FACTORY.png_file(storage=STORAGE) # type: ignore
pub_date = FACTORY.date() # type: ignore
safe_for_work = FACTORY.pybool() # type: ignore
minutes_to_read = FACTORY.pyint(min_value=1, max_value=10) # type: ignore
author = SubFactory(UserFactory) # type: ignore

class Meta:
model = Article
Expand Down
4 changes: 2 additions & 2 deletions fake.py
Original file line number Diff line number Diff line change
Expand Up @@ -2523,9 +2523,9 @@ def get_provider_for_type(cls, field_type) -> Optional[Callable]:
return None
if (
hasattr(field_type, "__origin__")
and field_type.__origin__ is Optional
and field_type.__origin__ is Optional # noqa
):
field_type = field_type.__args__[0]
field_type = field_type.__args__[0] # noqa
return cls.TYPE_TO_PROVIDER.get(field_type)

@classmethod
Expand Down

0 comments on commit b5d441d

Please sign in to comment.