[BUG] .from_dict
fails with from __future__ import annotations
and dataclass definition within the same function
#548
Labels
bug
Something isn't working
Description
I've encountered this issue when writing tests for my project with pytest.
The test is contained in one function and I've added a file to test the behavior of
from __future__ import annotations
All my nested dataclass_json field tests failed (when a field of one dataclass_json is another dataclass_json) on
.from_dict
for the example below I've got this traceback :
Workaround : moving the inner dataclass definition out of the function code block.
Code snippet that reproduces the issue
Describe the results you expected
MyClass(my_inner_inst=InnerClass(my_str='asdf', my_int=2))
Python version you are using
3.11.4
Environment description
The text was updated successfully, but these errors were encountered: