diff --git a/.gitignore b/.gitignore index d510d861..c783fc2d 100644 --- a/.gitignore +++ b/.gitignore @@ -95,3 +95,6 @@ venv/ ENV/ env.bak/ venv.bak/ + +# File created by pytest +testing.json diff --git a/dataclass_wizard/parsers.py b/dataclass_wizard/parsers.py index 2e87db5c..e3c810ef 100644 --- a/dataclass_wizard/parsers.py +++ b/dataclass_wizard/parsers.py @@ -401,10 +401,7 @@ def __post_init__(self, cls: Type, # Total count should be `Infinity` here, since the variadic form # accepts any number of possible arguments. self.total_count: N = float('inf') - # Check for the count of parsers which don't handle `NoneType` - this - # should exclude the parsers for `Union` types that have `None` in the - # list of args. - self.required_count = 0 if None in self.first_elem_parser[0] else 1 + self.required_count = 0 def __call__(self, o: M) -> M: """ diff --git a/tests/unit/test_load.py b/tests/unit/test_load.py index 86f37d7c..d1af6c1c 100644 --- a/tests/unit/test_load.py +++ b/tests/unit/test_load.py @@ -1150,6 +1150,8 @@ class MyClass(JSONSerializable): # conversion to `int` still succeeds. Might need to change this # behavior later if needed. [{}], does_not_raise(), (0, )), + ( + [], does_not_raise(), tuple()), ( [True, False, True], pytest.raises(TypeError), None), (