def test_pop_additional_pubnotes_includes_label(): schema = load_schema('hep') subschema = schema['properties']['references'] builder = ReferenceBuilder() builder.add_misc("Additional pubnote: J.Testing,42,R477") builder.set_label('Hello') expected = [ { 'reference': { 'publication_info': { 'journal_title': 'J.Testing', 'journal_volume': '42', 'page_start': 'R477', 'artid': 'R477' }, 'misc': [ 'Additional pubnote split from previous reference', ], 'label': 'Hello', }, }, ] result = list(builder.pop_additional_pubnotes()) assert validate(result, subschema) is None assert expected == result assert 'misc' not in builder.obj['reference'] assert builder.obj['reference']['label'] == 'Hello'
def test_set_label(): schema = load_schema('hep') subschema = schema['properties']['references'] builder = ReferenceBuilder() builder.set_label('Abe et al, 2008') expected = [ { 'reference': { 'label': 'Abe et al, 2008', }, }, ] result = [builder.obj] assert validate(result, subschema) is None assert expected == result