You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class UserFactory(factory.alchemy.SQLAlchemyModelFactory):
class Meta:
model = UserModel
email = factory.Faker("email")
mypy throws error: Missing type parameters for generic type "SQLAlchemyModelFactory" [type-arg]
but when add the parameter like this: factory.alchemy.SQLAlchemyModelFactory[UserModel] then when you execute the code it throws an error: E TypeError: <SQLAlchemyModelFactory (abstract)> is not a generic class
It's because stubs define SQLAlchemyModelFactory as a generic class but in fact it's not generic. In the source code of factory-boy you've got
class SQLAlchemyModelFactory(base.Factory)
and
class Factory(BaseFactory[T], metaclass=FactoryMetaClass)
but SQLAlchemyModelFactory itself is not generic. Could you fix that? For now I have to ignore the line for mypy
The text was updated successfully, but these errors were encountered:
When you define a factory like this:
mypy throws error:
Missing type parameters for generic type "SQLAlchemyModelFactory" [type-arg]
but when add the parameter like this: factory.alchemy.SQLAlchemyModelFactory[UserModel] then when you execute the code it throws an error: E TypeError: <SQLAlchemyModelFactory (abstract)> is not a generic class
It's because stubs define SQLAlchemyModelFactory as a generic class but in fact it's not generic. In the source code of factory-boy you've got
class SQLAlchemyModelFactory(base.Factory)
and
class Factory(BaseFactory[T], metaclass=FactoryMetaClass)
but SQLAlchemyModelFactory itself is not generic. Could you fix that? For now I have to ignore the line for mypy
The text was updated successfully, but these errors were encountered: