Skip to content

Commit 22a2771

Browse files
committed
add test for ArrayUnmarshaller return nullable
1 parent 6600f0c commit 22a2771

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/unit/unmarshalling/test_unmarshal.py

+21
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,27 @@ def test_array_valid(self, unmarshaller_factory):
352352

353353
assert result == value
354354

355+
def test_array_null(self, unmarshaller_factory):
356+
schema = Schema(
357+
'array',
358+
items=Schema('integer'),
359+
)
360+
value = None
361+
362+
with pytest.raises(TypeError):
363+
unmarshaller_factory(schema)(value)
364+
365+
def test_array_nullable(self, unmarshaller_factory):
366+
schema = Schema(
367+
'array',
368+
items=Schema('integer'),
369+
nullable=True,
370+
)
371+
value = None
372+
result = unmarshaller_factory(schema)(value)
373+
374+
assert result is None
375+
355376
def test_array_of_string_string_invalid(self, unmarshaller_factory):
356377
schema = Schema('array', items=Schema('string'))
357378
value = '123'

0 commit comments

Comments
 (0)