@@ -163,6 +163,27 @@ def create_schema(root_id):
163
163
}
164
164
}
165
165
},
166
+ 'testR' : {
167
+ 'title' : 'R title' ,
168
+ 'type' : 'array' ,
169
+ 'rollUp' : ['id' , 'testB' ],
170
+ 'items' : {
171
+ 'type' : 'object' ,
172
+ 'properties' : {
173
+ 'id' : {
174
+ 'title' : 'Identifier' ,
175
+ 'type' : 'string' ,
176
+ # 'type': 'integer',
177
+ # integer does not work, as testB:integer is not
178
+ # in the rollUp
179
+ },
180
+ 'testB' : {
181
+ 'title' : 'B title' ,
182
+ 'type' : 'string' ,
183
+ },
184
+ }
185
+ }
186
+ },
166
187
'testU' : {
167
188
'title' : UNICODE_TEST_STRING ,
168
189
'type' : 'string' ,
@@ -193,59 +214,61 @@ def create_schema(root_id):
193
214
}]
194
215
),
195
216
# Nested
196
- pytest . mark . xfail ( (
217
+ (
197
218
[{
198
219
'ROOT_ID_TITLE' : 1 ,
199
- 'id ' : 2 ,
220
+ 'Identifier ' : 2 ,
200
221
'B title:C title' : 3 ,
201
- 'B title:C title' : 4 ,
222
+ 'B title:D title' : 4 ,
202
223
}],
203
224
[{
204
225
'ROOT_ID' : 1 ,
205
226
'id' : 2 ,
206
227
'testB' : {'testC' : 3 , 'testD' : 4 }
207
228
}]
208
- )) ,
229
+ ),
209
230
# Unicode
210
- pytest . mark . xfail ( (
231
+ (
211
232
[{
212
233
'ROOT_ID_TITLE' : UNICODE_TEST_STRING ,
213
- ' UNICODE_TEST_STRING' : UNICODE_TEST_STRING
234
+ UNICODE_TEST_STRING : UNICODE_TEST_STRING
214
235
}],
215
236
[{
216
237
'ROOT_ID' : UNICODE_TEST_STRING ,
217
238
'testU' : UNICODE_TEST_STRING
218
239
}]
219
- )) ,
240
+ ),
220
241
# Rollup
221
- pytest . mark . xfail ( (
242
+ (
222
243
[{
223
244
'ROOT_ID_TITLE' : 1 ,
224
- 'id ' : 2 ,
225
- 'A title:Identifier' : 3 ,
226
- 'A title:B title' : 4
245
+ 'Identifier ' : 2 ,
246
+ 'R title:Identifier' : 3 ,
247
+ 'R title:B title' : 4
227
248
}],
228
249
[{
229
- 'ROOT_ID' : 1 , 'id' : 2 , 'testA' : [{
250
+ 'ROOT_ID' : 1 ,
251
+ 'id' : 2 ,
252
+ 'testR' : [{
230
253
'id' : 3 , 'testB' : 4
231
254
}]
232
255
}]
233
- )) ,
256
+ ),
234
257
# Rollup without an ID
235
- pytest . mark . xfail ( (
258
+ (
236
259
[{
237
260
'ROOT_ID_TITLE' : '1' ,
238
- 'A title:Identifier' : 2 ,
239
- 'A title:B title' : 3
261
+ 'R title:Identifier' : '2' ,
262
+ 'R title:B title' : '3'
240
263
}],
241
264
[{
242
265
'ROOT_ID' : '1' ,
243
- 'testA ' : [{
266
+ 'testR ' : [{
244
267
'id' : '2' ,
245
268
'testB' : '3'
246
269
}]
247
270
}]
248
- )) ,
271
+ ),
249
272
# Empty
250
273
(
251
274
[{
@@ -305,6 +328,9 @@ def test_unflatten(convert_titles, use_schema, root_id, root_id_kwargs, input_li
305
328
if convert_titles :
306
329
parser = SchemaParser (
307
330
root_schema_dict = create_schema (root_id ) if use_schema else {},
331
+ main_sheet_name = 'custom_main' ,
332
+ root_id = root_id ,
333
+ rollup = True ,
308
334
use_titles = True
309
335
)
310
336
parser .parse ()
@@ -321,8 +347,8 @@ def test_unflatten(convert_titles, use_schema, root_id, root_id_kwargs, input_li
321
347
assert recwarn .list == []
322
348
323
349
324
- @pytest .mark .parametrize ('root_id,root_id_kwargs' , ROOT_ID_PARAMS )
325
350
@pytest .mark .parametrize ('input_list,expected_output_list' , testdata_titles )
351
+ @pytest .mark .parametrize ('root_id,root_id_kwargs' , ROOT_ID_PARAMS )
326
352
def test_unflatten_titles (root_id , root_id_kwargs , input_list , expected_output_list , recwarn ):
327
353
"""
328
354
Essentially the same as test unflatten, except that convert_titles and
0 commit comments