factory_boy icon indicating copy to clipboard operation
factory_boy copied to clipboard

Example Django test code references missing member

Open jeffwidman opened this issue 2 years ago • 0 comments

https://github.com/FactoryBoy/factory_boy/blob/edb6c2ee76c842ab9d6c5435ef1e63527c877507/examples/django_demo/generic_foreignkey/tests.py#L19 results in Pylance complaining:

Cannot access member "tag" for type "TaggedUserFactory"
  Member "tag" is unknown

Similarly: https://github.com/FactoryBoy/factory_boy/blob/edb6c2ee76c842ab9d6c5435ef1e63527c877507/examples/django_demo/generic_foreignkey/tests.py#L22 results in Pylance complaining:

Argument of type "SubFactory" cannot be assigned to parameter "model" of type "Type[Model] | Model" in function "get_for_model"
  Type "SubFactory" cannot be assigned to type "Type[Model] | Model"
    Type "SubFactory" cannot be assigned to type "Type[Model]"
    "SubFactory" is incompatible with "Model"

I poked at a bit, resulting in #988, but I don't use Django much, so still wasn't quite sure what needed to happen to fix these.

jeffwidman avatar Oct 27 '22 20:10 jeffwidman