Bug: Optional lists in coverage produce nested lists
Opened this issue · 2 comments
Vegemash commented
Description
A pydantic BaseModel field with the type list[int] | None
will produce [[123]]
Fix incoming
MCVE
from pydantic import BaseModel
from polyfactory.factories.pydantic_factory import ModelFactory
class Model(BaseModel):
optional_list: list[int] | None
list(ModelFactory._get_or_create_factory(Model).coverage())
Steps to reproduce
Run the above
Release Version
2.15
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 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.