Skip to content

Commit

Permalink
Fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi committed Sep 1, 2022
1 parent 40e01c7 commit 7924ff9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/test_generics_and_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,24 +366,23 @@ class Wrapper:
subclass: Union[TypeA, TypeB] = TypeA(1)

wrapper1 = Wrapper() # Create Wrapper object.
wrapper2 = dcargs.extras.from_yaml(
dcargs.extras.from_yaml(
Wrapper, dcargs.extras.to_yaml(wrapper1)
) # Errors, no constructor for TypeA


def test_annotated():
# https://github.com/brentyi/dcargs/issues/7
from typing import Union

@dataclasses.dataclass
class TypeA:
data: int

@dataclasses.dataclass
class Wrapper:
subclass: Annotated[int, TypeA] = TypeA(1)
subclass: Annotated[TypeA, int] = TypeA(1)

wrapper1 = Wrapper() # Create Wrapper object.
wrapper2 = dcargs.extras.from_yaml(
dcargs.extras.from_yaml(
Wrapper, dcargs.extras.to_yaml(wrapper1)
) # Errors, no constructor for TypeA

0 comments on commit 7924ff9

Please sign in to comment.