Skip to content

Commit

Permalink
Add a regression test for a nested tagged union scenario (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluetech authored Nov 15, 2023
1 parent 4df0c9e commit a9d349a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/strategies/test_tagged_unions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Union
from typing import Optional, Sequence, Union

from attrs import define

Expand Down Expand Up @@ -138,3 +138,15 @@ class B:

data = c.unstructure(A(), Union[A, B])
c.structure(data, Union[A, B])


def test_nested_sequence_union():
@define
class Top:
u: Optional[Sequence[Union[A, B]]]

c = Converter()
configure_tagged_union(Union[A, B], c)

data = c.unstructure(Top(u=[B(a="")]), Top)
c.structure(data, Top)

0 comments on commit a9d349a

Please sign in to comment.