Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Optional lists in coverage produce nested lists #526

Open
1 of 4 tasks
Vegemash opened this issue Apr 18, 2024 · 1 comment
Open
1 of 4 tasks

Bug: Optional lists in coverage produce nested lists #526

Vegemash opened this issue Apr 18, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Vegemash
Copy link

Vegemash commented Apr 18, 2024

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.
Fund with Polar
@Vegemash Vegemash added the bug Something isn't working label Apr 18, 2024
@guacs
Copy link
Member

guacs commented Apr 22, 2024

@Vegemash thanks for reporting this and for the PR! I'm a bit swamped at the moment, but I'll take a look at the PR (if no one else has a chance) sometime this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants