Skip to content

Commit df09162

Browse files
committed
Attempt to fix regression in unit test
Fix the following issue: > UnboundLocalError: cannot access local variable 'JSON' where it is > not associated with a value This, however, yields another problem: ```plain > load = CLASS_TO_LOAD_FUNC[cls] E KeyError: <class 'tests.unit.v1.test_union_as_type_alias_recursive.test_union_as_type_alias_recursive.<locals>.MyTestClass'> During handling of the above exception, another exception occurred: […] E NameError: name 'JSON' is not defined ```
1 parent cc95699 commit df09162

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/unit/v1/test_union_as_type_alias_recursive.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from dataclasses import dataclass
2+
from typing import Union
23

34
from dataclass_wizard import JSONWizard
45

@@ -9,7 +10,7 @@ def test_union_as_type_alias_recursive():
910
Recursive or self-referential `Union` (defined as `TypeAlias`)
1011
types are supported.
1112
"""
12-
JSON = str | int | float | bool | dict[str, JSON] | list[JSON] | None
13+
JSON = Union[str, int, float, bool, dict[str, "JSON"], list["JSON"], None]
1314

1415
@dataclass
1516
class MyTestClass(JSONWizard):

0 commit comments

Comments
 (0)