def test_reference_builder_no_uids(): rb = ReferenceBuilder() rb.set_number('oops') rb.set_number('1') rb.set_texkey('book') rb.add_title('Awesome Paper') rb.add_raw_reference('[1] Awesome Paper', 'arXiv') rb.add_misc('misc 0') rb.add_misc('misc 1') rb.add_author('Cox, Brian') rb.add_author('O Briain, Dara', 'ed.') rb.set_pubnote('Nucl.Phys.,B360,362') rb.set_pubnote('BAD PUBNOTE') rb.set_year('oops') rb.set_year('1991') rb.add_url('http://example.com') rb.set_publisher('Elsevier') rb.add_collaboration('ALICE') rb.add_report_number('hep-th/0603001') rb.add_report_number('hep-th/0603002') rb.add_report_number('arXiv:0705.0016 [hep-th]') rb.add_report_number('0705.0017 [hep-th]') rb.add_report_number('NOT ARXIV') expected = { 'number': 1, 'texkey': 'book', 'titles': [{'title': 'Awesome Paper'}], 'raw_reference': [ {'value': '[1] Awesome Paper', 'format': 'text', 'source': 'arXiv'}, {'value': 'BAD PUBNOTE', 'format': 'text', 'source': 'reference_builder'} ], 'misc': ['misc 0', 'misc 1'], 'authors': [{'full_name': 'Cox, Brian'}, {'full_name': 'O Briain, Dara', 'role': 'ed.'}], 'publication_info': { 'journal_title': 'Nucl.Phys.', 'journal_volume': 'B360', 'page_start': '362', 'artid': '362', 'reportnumber': 'NOT ARXIV', 'year': 1991 }, 'collaboration': ['ALICE'], 'imprint': {'publisher': 'Elsevier'}, 'arxiv_eprints': ['arXiv:hep-th/0603001', 'arXiv:hep-th/0603002', 'arXiv:0705.0016', 'arXiv:0705.0017'], 'urls': [{'value': 'http://example.com'}] } assert expected == rb.obj
def test_reference_builder_no_uids(): rb = ReferenceBuilder() rb.set_number('oops') rb.set_number('1') rb.set_texkey('book') rb.add_title('Awesome Paper') rb.add_raw_reference('[1] Awesome Paper', 'arXiv') rb.add_misc('misc 0') rb.add_misc('misc 1') rb.add_author('Cox, Brian') rb.add_author('O Briain, Dara', 'ed.') rb.set_pubnote('Nucl.Phys.,B360,362') rb.set_pubnote('BAD PUBNOTE') rb.set_year('oops') rb.set_year('1991') rb.add_url('http://example.com') rb.set_publisher('Elsevier') rb.add_collaboration('ALICE') rb.add_report_number('hep-th/0603001') rb.add_report_number('hep-th/0603002') rb.add_report_number('arXiv:0705.0016 [hep-th]') rb.add_report_number('0705.0017 [hep-th]') rb.add_report_number('NOT ARXIV') expected = { "reference": { "texkey": "book", "collaboration": [ "ALICE" ], "arxiv_eprints": [ "arXiv:hep-th/0603001", "arXiv:hep-th/0603002", "arXiv:0705.0016", "arXiv:0705.0017" ], "misc": [ "misc 0", "misc 1" ], "number": 1, "imprint": { "publisher": "Elsevier" }, "titles": [ { "title": "Awesome Paper" } ], "urls": [ { "value": "http://example.com" } ], "authors": [ { "full_name": "Cox, Brian" }, { "role": "ed.", "full_name": "O Briain, Dara" } ], "publication_info": { "journal_title": "Nucl.Phys.", "journal_volume": "B360", "reportnumber": "NOT ARXIV", "artid": "362", "year": 1991, "page_start": "362" } }, "raw_refs": [ { "source": "arXiv", "value": "[1] Awesome Paper", "schema": "text" }, { "source": "reference_builder", "value": "BAD PUBNOTE", "schema": "text" } ] } assert expected == rb.obj
def test_reference_builder_no_uids(): rb = ReferenceBuilder() rb.set_number('oops') rb.set_number('1') rb.set_texkey('book') rb.add_title('Awesome Paper') rb.add_raw_reference('[1] Awesome Paper', 'arXiv') rb.add_misc('misc 0') rb.add_misc('misc 1') rb.add_author('Cox, Brian') rb.add_author('O Briain, Dara', 'ed.') rb.set_pubnote('Nucl.Phys.,B360,362') rb.set_pubnote('BAD PUBNOTE') rb.set_year('oops') rb.set_year('1991') rb.add_url('http://example.com') rb.set_publisher('Elsevier') rb.add_collaboration('ALICE') rb.add_report_number('hep-th/0603001') rb.add_report_number('hep-th/0603002') rb.add_report_number('arXiv:0705.0016 [hep-th]') rb.add_report_number('0705.0017 [hep-th]') rb.add_report_number('NOT ARXIV') expected = { "reference": { "texkey": "book", "collaboration": ["ALICE"], "arxiv_eprints": [ "arXiv:hep-th/0603001", "arXiv:hep-th/0603002", "arXiv:0705.0016", "arXiv:0705.0017" ], "misc": ["misc 0", "misc 1"], "number": 1, "imprint": { "publisher": "Elsevier" }, "titles": [{ "title": "Awesome Paper" }], "urls": [{ "value": "http://example.com" }], "authors": [{ "full_name": "Cox, Brian" }, { "role": "ed.", "full_name": "O Briain, Dara" }], "publication_info": { "journal_title": "Nucl.Phys.", "journal_volume": "B360", "reportnumber": "NOT ARXIV", "artid": "362", "year": 1991, "page_start": "362" } }, "raw_refs": [{ "source": "arXiv", "value": "[1] Awesome Paper", "schema": "text" }, { "source": "reference_builder", "value": "BAD PUBNOTE", "schema": "text" }] } assert expected == rb.obj
def test_reference_builder_no_uids(): rb = ReferenceBuilder() rb.set_number('oops') rb.set_number('1') rb.set_texkey('book') rb.add_title('Awesome Paper') rb.add_raw_reference('[1] Awesome Paper', 'arXiv') rb.add_misc('misc 0') rb.add_misc('misc 1') rb.add_author('Cox, Brian') rb.add_author('O Briain, Dara', 'ed.') rb.set_pubnote('Nucl.Phys.,B360,362') rb.set_pubnote('BAD PUBNOTE') rb.set_year('oops') rb.set_year('1991') rb.add_url('http://example.com') rb.set_publisher('Elsevier') rb.add_collaboration('ALICE') rb.add_report_number('hep-th/0603001') rb.add_report_number('hep-th/0603002') rb.add_report_number('arXiv:0705.0016 [hep-th]') rb.add_report_number('0705.0017 [hep-th]') rb.add_report_number('NOT ARXIV') expected = { 'number': 1, 'texkey': 'book', 'titles': [{ 'title': 'Awesome Paper' }], 'raw_reference': [{ 'value': '[1] Awesome Paper', 'format': 'text', 'source': 'arXiv' }, { 'value': 'BAD PUBNOTE', 'format': 'text', 'source': 'reference_builder' }], 'misc': ['misc 0', 'misc 1'], 'authors': [{ 'full_name': 'Cox, Brian' }, { 'full_name': 'O Briain, Dara', 'role': 'ed.' }], 'publication_info': { 'journal_title': 'Nucl.Phys.', 'journal_volume': 'B360', 'page_start': '362', 'artid': '362', 'reportnumber': 'NOT ARXIV', 'year': 1991 }, 'collaboration': ['ALICE'], 'imprint': { 'publisher': 'Elsevier' }, 'arxiv_eprints': [ 'arXiv:hep-th/0603001', 'arXiv:hep-th/0603002', 'arXiv:0705.0016', 'arXiv:0705.0017' ], 'urls': [{ 'value': 'http://example.com' }] } assert expected == rb.obj