calling the flatten_annotation function with an optional annotation int | None/Optional[int] does not properly flatten the annotation, instead the result is [NoneType,[int]] (expected: [NoneType, int])
MCVE
# Your MCVE code here
@dataclass
class OptionalInt:
i: Optional[int]
class OptionalIntFactory(DataclassFactory[OptionalInt]):
__model__ = OptionalInt
results = list(OptionalIntFactory.coverage())
Steps to reproduce
Run the `<factory>.coverage()` function with any factory for a model that has an optional field
Logs
TypeError: unhashable type: 'list'
Release Version
2.12.0
Platform
[X] Linux
[ ] Mac
[ ] Windows
[ ] Other (Please specify in the description above)
Description
calling the
flatten_annotation
function with an optional annotationint | None
/Optional[int]
does not properly flatten the annotation, instead the result is[NoneType,[int]]
(expected:[NoneType, int]
)MCVE
Steps to reproduce
Logs
Release Version
2.12.0
Platform