File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -341,6 +341,7 @@ def test_rollup():
341
341
assert set (parser .sub_sheets ) == set (['testA' ])
342
342
assert set (parser .sub_sheets ['testA' ]) == set (['ocid' , 'testB' , 'testC' ])
343
343
344
+
344
345
def test_bad_rollup (recwarn ):
345
346
'''
346
347
When rollUp is specified, but the field is missing in the schema, we expect
@@ -486,6 +487,35 @@ def test_use_titles(recwarn):
486
487
assert 'does not have a title' in text_type (w .message )
487
488
488
489
490
+ def test_titles_rollup ():
491
+ parser = SchemaParser (root_schema_dict = {
492
+ 'properties' : {
493
+ 'testA' : {
494
+ 'type' : 'array' ,
495
+ 'title' : 'ATitle' ,
496
+ 'rollUp' : [ 'testB' ],
497
+ 'items' : {
498
+ 'type' : 'object' ,
499
+ 'properties' : {
500
+ 'testB' : {
501
+ 'type' : 'string' ,
502
+ 'title' : 'BTitle' ,
503
+ },
504
+ 'testC' : {
505
+ 'type' : 'string' ,
506
+ 'title' : 'CTitle' ,
507
+ }
508
+ }
509
+ }
510
+ },
511
+ }
512
+ }, rollup = True , use_titles = True )
513
+ parser .parse ()
514
+ assert set (parser .main_sheet ) == set (['ATitle:BTitle' ])
515
+ assert set (parser .sub_sheets ) == set (['testA' ])
516
+ assert set (parser .sub_sheets ['testA' ]) == set (['ocid' , 'BTitle' , 'CTitle' ])
517
+
518
+
489
519
def test_schema_from_uri (httpserver ):
490
520
httpserver .serve_content ('{"a":{"$ref":"#/b"}, "b":"c"}' , 404 )
491
521
parser = SchemaParser (schema_filename = httpserver .url )
You can’t perform that action at this time.
0 commit comments