Skip to content

Commit cdf71fd

Browse files
committed
Merge branch 'master' into 90-json-pointer-multisheet
2 parents 8943dc7 + 393e1c1 commit cdf71fd

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

flattentool/input.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def list_as_dicts_to_temporary_dicts(unflattened):
265265
def unflatten_main_with_parser(parser, line, timezone):
266266
unflattened = OrderedDict()
267267
for path, value in line.items():
268-
if not value:
268+
if value is None or value == '':
269269
continue
270270
current_path = unflattened
271271
path_list = [item.rstrip('[]') for item in path.split('/')]
@@ -314,7 +314,7 @@ def unflatten_main_with_parser(parser, line, timezone):
314314

315315
## Other Types
316316
converted_value = convert_type(current_type or '', value, timezone)
317-
if converted_value:
317+
if converted_value is not None and converted_value != '':
318318
current_path[path_item] = converted_value
319319

320320
unflattened = list_as_dicts_to_temporary_dicts(unflattened)

flattentool/tests/test_input_SpreadsheetInput_unflatten.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ def inject_root_id(root_id, d):
5454
'testA': 3
5555
}]
5656
),
57+
(
58+
'Basic with zero',
59+
[{
60+
'ROOT_ID': '1',
61+
'id': 2,
62+
'testA': 0
63+
}],
64+
[{
65+
'ROOT_ID': '1',
66+
'id': 2,
67+
'testA': 0
68+
}]
69+
),
5770
(
5871
'Nested',
5972
[{

0 commit comments

Comments
 (0)