Skip to content

Commit ccf4991

Browse files
committed
Expand test suite to cover null values in XLSXListField
1 parent 9a0f47f commit ccf4991

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/test_fields.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,21 @@ def test_cell_complex_types(self, style: XLSXStyle, worksheet: Worksheet):
444444
assert isinstance(cell, Cell)
445445
assert cell.value == '[{"a": 1}, {"b": 2}]'
446446

447+
def test_cell_with_null_value(self, style: XLSXStyle, worksheet: Worksheet):
448+
f = XLSXListField(
449+
list_sep=None,
450+
key="objs",
451+
value=None,
452+
field=ListField(allow_null=True),
453+
style=style,
454+
mapping="",
455+
cell_style=style,
456+
)
457+
assert f.original_value is f.value is None
458+
cell = f.cell(worksheet, 1, 1)
459+
assert isinstance(cell, Cell)
460+
assert cell.value is None
461+
447462

448463
class TestXLSXBooleanField:
449464
@pytest.mark.parametrize("value", [True, False])

0 commit comments

Comments
 (0)