youtux / types-factory-boy

Type stubs for factory-boy
MIT License
18 stars 4 forks source link

Not working with `create(...)` and `create_batch` somehow #10

Open sshishov opened 1 year ago

sshishov commented 1 year ago

I am getting a lot of this errors:

error: "Callable[[VarArg(Any), KwArg(Any)], NoReturn]" has no attribute "create"  [attr-defined]
error: "Callable[[VarArg(Any), KwArg(Any)], NoReturn]" has no attribute "create_batch"  [attr-defined]

when apply the type to DjangoModelFactory

youtux commented 1 year ago

can you check if v0.4.0 fixed the issue?

sshishov commented 1 year ago

@youtux sorry, please let me check...

UPDATE: I have checked, it is not the issue anymore (if we are using Factory.create() and Factory.build() everywhere, instead of Factory()

The question which I have now, for every factory.Faker(...) I am getting this error:

Need type annotation for "<field_name>"

How to fight with this one?

youtux commented 1 year ago

can you post the full stack trace, together with the code you are using?

sshishov commented 1 year ago

And also I have the problem like this, when I add the type declaration for generic DjangoModelFactory:

TypeError: type 'DjangoModelFactory' is not subscriptable

I will create a small reproduction repo shortly. Cannot post from our repo as it is private one, sorry ;)