Bug: `init=False` not respected for dataclasses
guacs opened this issue · 0 comments
guacs commented
Description
Marking a field to be ignored in the __init__
results in a TypeError
.
URL to code causing the issue
No response
MCVE
from dataclasses import dataclass, field
from polyfactory.factories import DataclassFactory
@dataclass
class Foo:
no_init: int = field(init=False)
FooFactory = DataclassFactory.create_factory(Foo)
foo = FooFactory.build()
Steps to reproduce
No response
Screenshots
No response
Logs
No response
Release Version
2.10.0
Platform
- Linux
- Mac
- Windows
- Other (Please specify in the description above)
Note
While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.
Check out all issues funded or available for funding on our Polar.sh Litestar dashboard
- If you would like to see an issue prioritized, make a pledge towards it!
- We receive the pledge once the issue is completed & verified
- This, along with engagement in the community, helps us know which features are a priority to our users.