litestar-org/polyfactory

Bug: confrozenset doesn't work

jtraub opened this issue · 1 comments

I started experimenting with pydantic-factories and found out that confrozenset does not work

This code

class Test(BaseModel):
    a: confrozenset(item_type=int, min_items=10)  # type: ignore[valid-type]


class TestFactory(ModelFactory):
    __model__ = Test


result = TestFactory.build()

produces

Traceback (most recent call last):
  File "/tmp/test_proj/test.py", line 24, in <module>
    result = TestFactory.build()
  File "/tmp/test_proj/venv/lib/python3.10/site-packages/pydantic_factories/factory.py", line 716, in build
    kwargs[field_name] = cls.get_field_value(model_field, field_parameters=kwargs.get(field_name, {}))
  File "/tmp/test_proj/venv/lib/python3.10/site-packages/pydantic_factories/factory.py", line 603, in get_field_value
    return cls._handle_constrained_field(model_field=model_field)
  File "/tmp/test_proj/venv/lib/python3.10/site-packages/pydantic_factories/factory.py", line 279, in _handle_constrained_field
    return frozenset(*result) if issubclass(outer_type, ConstrainedFrozenSet) else result
TypeError: frozenset expected at most 1 argument, got 10

good find