Skip to content

Commit a9d349a

Browse files
authored
Add a regression test for a nested tagged union scenario (#444)
1 parent 4df0c9e commit a9d349a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/strategies/test_tagged_unions.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Union
1+
from typing import Optional, Sequence, Union
22

33
from attrs import define
44

@@ -138,3 +138,15 @@ class B:
138138

139139
data = c.unstructure(A(), Union[A, B])
140140
c.structure(data, Union[A, B])
141+
142+
143+
def test_nested_sequence_union():
144+
@define
145+
class Top:
146+
u: Optional[Sequence[Union[A, B]]]
147+
148+
c = Converter()
149+
configure_tagged_union(Union[A, B], c)
150+
151+
data = c.unstructure(Top(u=[B(a="")]), Top)
152+
c.structure(data, Top)

0 commit comments

Comments
 (0)