Skip to content

Commit 4e740c8

Browse files
committed
[#50] Add xfail tests for preferred title behaviour
1 parent 0dc9807 commit 4e740c8

File tree

1 file changed

+54
-4
lines changed

1 file changed

+54
-4
lines changed

flattentool/tests/test_input_SpreadsheetInput_unflatten.py

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def inject_root_id(root_id, d):
7979
'testA': UNICODE_TEST_STRING
8080
}]
8181
),
82-
# Rollup
82+
# Single item array
8383
(
8484
[{
8585
'ROOT_ID': 1,
@@ -93,7 +93,7 @@ def inject_root_id(root_id, d):
9393
}]
9494
}]
9595
),
96-
# Rollup without an ID
96+
# Single item array withou parent ID
9797
(
9898
[{
9999
'ROOT_ID': '1',
@@ -181,6 +181,10 @@ def create_schema(root_id):
181181
'title': 'B title',
182182
'type': 'string',
183183
},
184+
'testC': {
185+
'title': 'C title',
186+
'type': 'string',
187+
},
184188
}
185189
}
186190
},
@@ -227,6 +231,20 @@ def create_schema(root_id):
227231
'testB': {'testC': 3, 'testD': 4}
228232
}]
229233
),
234+
# Nested titles should be converted individually
235+
pytest.mark.xfail((
236+
[{
237+
'ROOT_ID_TITLE': 1,
238+
'Identifier': 2,
239+
'B title:C title': 3,
240+
'B title:Not in schema': 4,
241+
}],
242+
[{
243+
'ROOT_ID': 1,
244+
'id': 2,
245+
'testB': {'testC': 3, 'Not in schema': 4}
246+
}]
247+
)),
230248
# Unicode
231249
(
232250
[{
@@ -238,7 +256,7 @@ def create_schema(root_id):
238256
'testU': UNICODE_TEST_STRING
239257
}]
240258
),
241-
# Rollup
259+
# Single item array
242260
(
243261
[{
244262
'ROOT_ID_TITLE': 1,
@@ -254,7 +272,7 @@ def create_schema(root_id):
254272
}]
255273
}]
256274
),
257-
# Rollup without an ID
275+
# Single item array without parent ID
258276
(
259277
[{
260278
'ROOT_ID_TITLE': '1',
@@ -269,6 +287,38 @@ def create_schema(root_id):
269287
}]
270288
}]
271289
),
290+
# Properties of a single item array shouldn't need to be in rollUp list
291+
# for their titles to be converted
292+
pytest.mark.xfail((
293+
[{
294+
'ROOT_ID_TITLE': 1,
295+
'Identifier': 2,
296+
'R title:Identifier': 3,
297+
'R title:C title': 4
298+
}],
299+
[{
300+
'ROOT_ID': 1,
301+
'id': 2,
302+
'testR': [{
303+
'id': 3,
304+
'testC': 4
305+
}]
306+
}]
307+
)),
308+
# Single item array, titles should be converted individually
309+
pytest.mark.xfail((
310+
[{
311+
'ROOT_ID_TITLE': 1,
312+
'Identifier': 2,
313+
'R title:C title': 3,
314+
'R title:Not in schema': 4,
315+
}],
316+
[{
317+
'ROOT_ID': 1,
318+
'id': 2,
319+
'testR': {'testC': 3, 'Not in schema': 4}
320+
}]
321+
)),
272322
# Empty
273323
(
274324
[{

0 commit comments

Comments
 (0)