Closed matt035343 closed 11 months ago
Coverage Report
File Stmts Miss Cover Missing dataclasses_json cfg.py 51 4 92% 77, 81–83 core.py 234 9 96% 38–41, 51, 64, 66, 81, 83, 169 mm.py 189 29 85% 33–36, 42–45, 53–56, 62–65, 88, 152–153, 158, 162, 166, 171, 175, 179, 187, 193, 198, 207, 212, 217, 235–242 stringcase.py 25 3 88% 59, 76, 97 undefined.py 143 2 99% 24, 38 utils.py 128 29 77% 11–24, 44–49, 60–64, 74, 99–100, 108–109, 158, 177, 202 tests entities.py 220 2 99% 229, 235 test_annotations.py 81 42 48% 50–67, 78–102, 106–122 test_api.py 142 2 99% 139–140 test_str_subclass.py 22 1 95% 9 TOTAL 2422 123 95%
Tests | Skipped | Failures | Errors | Time |
---|---|---|---|---|
283 | 1 :zzz: | 0 :x: | 0 :fire: | 4.631s :stopwatch: |
The bug still seems to happen, I have a Tuple[str, ...]
as a field in a class and just calling .schema()
on it fails with the following message:
E TypeError: Field.__init__() takes 1 positional argument but 2 positional arguments (and 3 keyword-only arguments) were given
Full code to reproduce on Python 3.10 (very straightforward):
@dataclass_json
@dataclass
class SomeClass:
tags: Tuple[str, ...] = None
def test_foo():
SomeClass.schema()
Hi @deansg. If I am not mistaken, this seems to be related to an old issue (#398 and #432) not directly related to what has been discussed in #440 and #435. I will have a look at #398 soon.
PR https://github.com/lidatong/dataclasses-json/pull/435 introduced a new bug that raises an exception when deserializing tuples defined with ellipsis (e.g.
Tuple[str, ...]
). This PR is fixing this issue.