예제 #1
0
def test_get_publi_info_from_publication_info_a_list_of_two_elements():
    publication_info_a_list_of_two_elements = Record({
        'publication_info': [
            {
                'journal_title': 'Int.J.Theor.Phys.',
                'journal_volume': '38',
                'page_start': '1113',
                'page_end': '1133',
                'year': 1999
            },
            {
                'journal_title': 'Adv.Theor.Math.Phys.',
                'journal_volume': '2',
                'page_start': '231',
                'page_end': '252',
                'year': 1998
            }
        ]
    })
    latex = Latex(publication_info_a_list_of_two_elements, 'latex_eu')

    expected = [
        'Int.\\ J.\\ Theor.\\ Phys.\\  {\\bf 38} (1999) 1113',
        '[Adv.\\ Theor.\\ Math.\\ Phys.\\  {\\bf 2} (1998) 231]'
    ]
    result = latex._get_publi_info()

    assert expected == result
예제 #2
0
def test_get_publi_info_from_publication_info_a_list_of_two_elements():
    publication_info_a_list_of_two_elements = InspireRecord({
        'publication_info': [
            {
                'journal_title': 'Int.J.Theor.Phys.',
                'journal_volume': '38',
                'page_start': '1113',
                'page_end': '1133',
                'year': 1999
            },
            {
                'journal_title': 'Adv.Theor.Math.Phys.',
                'journal_volume': '2',
                'page_start': '231',
                'page_end': '252',
                'year': 1998
            }
        ]
    })
    latex = Latex(publication_info_a_list_of_two_elements, 'latex_eu')

    expected = [
        'Int.\\ J.\\ Theor.\\ Phys.\\  {\\bf 38} (1999) 1113',
        '[Adv.\\ Theor.\\ Math.\\ Phys.\\  {\\bf 2} (1998) 231]'
    ]
    result = latex._get_publi_info()

    assert expected == result
예제 #3
0
def test_get_title_from_titles_an_empty_list():
    titles_an_empty_list = InspireRecord({'titles': []})
    latex = Latex(titles_an_empty_list, 'latex_eu')

    expected = ''
    result = latex._get_title()

    assert expected == result
예제 #4
0
def test_format_output_row_one_author():
    record = InspireRecord({})
    latex = Latex(record, 'latex_eu')

    expected = u'  S.~L.~Glashow,\n'
    result = latex._format_output_row('author', ['S.~L.~Glashow'])

    assert expected == result
예제 #5
0
def test_get_publi_info_from_publication_info_an_empty_list():
    publication_info_an_empty_list = InspireRecord({'publication_info': []})
    latex = Latex(publication_info_an_empty_list, 'latex_eu')

    expected = []
    result = latex._get_publi_info()

    assert expected == result
예제 #6
0
def test_format_output_row_between_one_and_eight_authors():
    record = InspireRecord({})
    latex = Latex(record, 'latex_eu')

    expected = u'  F.~Englert and R.~Brout,\n'
    result = latex._format_output_row('author', ['F.~Englert', 'R.~Brout'])

    assert expected == result
예제 #7
0
def test_get_report_number_yes_publi_info_yes_arxiv(g_a, g_p_i):
    g_a.return_value = True
    g_p_i.return_value = True

    record = InspireRecord({})
    latex = Latex(record, 'latex_eu')

    assert latex._get_report_number() is None
예제 #8
0
def test_get_title_no_titles():
    no_titles = InspireRecord({})
    latex = Latex(no_titles, 'latex_eu')

    expected = ''
    result = latex._get_title()

    assert expected == result
예제 #9
0
def test_format_output_row_unknown_field():
    record = InspireRecord({})
    latex = Latex(record, 'latex_eu')

    expected = ''
    result = latex._format_output_row('unknown_field', 'foo')

    assert expected == result
예제 #10
0
def test_get_publi_info_from_publication_info_an_empty_list():
    publication_info_an_empty_list = Record({'publication_info': []})
    latex = Latex(publication_info_an_empty_list, 'latex_eu')

    expected = []
    result = latex._get_publi_info()

    assert expected == result
예제 #11
0
def test_get_title_no_titles():
    no_titles = {}
    latex = Latex(no_titles, 'latex_eu')

    expected = ''
    result = latex._get_title()

    assert expected == result
예제 #12
0
def test_get_author_from_authors_an_empty_list():
    authors_an_empty_list = InspireRecord({'authors': []})
    latex = Latex(authors_an_empty_list, 'latex_eu')

    expected = []
    result = latex._get_author()

    assert expected == result
예제 #13
0
def test_get_title_from_titles_an_empty_list():
    titles_an_empty_list = Record({'titles': []})
    latex = Latex(titles_an_empty_list, 'latex_eu')

    expected = ''
    result = latex._get_title()

    assert expected == result
예제 #14
0
def test_format_output_row_unknown_field():
    record = Record({})
    latex = Latex(record, 'latex_eu')

    expected = ''
    result = latex._format_output_row('unknown_field', 'foo')

    assert expected == result
예제 #15
0
def test_get_author_from_corporate_author_an_empty_list():
    corporate_author_an_empty_list = Record({'corporate_author': []})
    latex = Latex(corporate_author_an_empty_list, 'latex_eu')

    expected = []
    result = latex._get_author()

    assert expected == result
예제 #16
0
def test_get_report_number_yes_publi_info_no_arxiv(g_a, g_p_i):
    g_a.return_value = True
    g_p_i.return_value = False

    record = {}
    latex = Latex(record, 'latex_eu')

    assert latex._get_report_number() is None
예제 #17
0
def test_format_output_row_arxiv_without_publi_info():
    without_publi_info = InspireRecord({})
    latex = Latex(without_publi_info, 'latex_eu')

    expected = u'  arXiv:1512.01296 [hep-th].\n'
    result = latex._format_output_row('arxiv', 'arXiv:1512.01296 [hep-th]')

    assert expected == result
예제 #18
0
def test_get_report_number_yes_publi_info_yes_arxiv(g_a, g_p_i):
    g_a.return_value = True
    g_p_i.return_value = True

    record = Record({})
    latex = Latex(record, 'latex_eu')

    assert latex._get_report_number() is None
예제 #19
0
def test_format_output_row_one_author():
    record = Record({})
    latex = Latex(record, 'latex_eu')

    expected = u'  S.~L.~Glashow,\n'
    result = latex._format_output_row('author', ['S.~L.~Glashow'])

    assert expected == result
예제 #20
0
def test_format_output_row_arxiv_without_publi_info():
    without_publi_info = Record({})
    latex = Latex(without_publi_info, 'latex_eu')

    expected = u'  arXiv:1512.01296 [hep-th].\n'
    result = latex._format_output_row('arxiv', 'arXiv:1512.01296 [hep-th]')

    assert expected == result
예제 #21
0
def test_format_output_row_title():
    record = InspireRecord({})
    latex = Latex(record, 'latex_eu')

    expected = u"  %``Partial Symmetries of Weak Interactions,''\n"
    result = latex._format_output_row('title', 'Partial Symmetries of Weak Interactions')

    assert expected == result
예제 #22
0
def test_format_output_row_between_one_and_eight_authors():
    record = Record({})
    latex = Latex(record, 'latex_eu')

    expected = u'  F.~Englert and R.~Brout,\n'
    result = latex._format_output_row('author', ['F.~Englert', 'R.~Brout'])

    assert expected == result
예제 #23
0
def test_get_author_from_corporate_author_an_empty_list():
    corporate_author_an_empty_list = InspireRecord({'corporate_author': []})
    latex = Latex(corporate_author_an_empty_list, 'latex_eu')

    expected = []
    result = latex._get_author()

    assert expected == result
예제 #24
0
def test_format_output_row_publi_info_not_a_list():
    record = Record({})
    latex = Latex(record, 'latex_eu')

    expected = u'  Phys. Lett. 12 (1964) 132-133.\n'
    result = latex._format_output_row('publi_info', 'Phys. Lett. 12 (1964) 132-133')

    assert expected == result
예제 #25
0
def test_format_output_row_title():
    record = Record({})
    latex = Latex(record, 'latex_eu')

    expected = u"  %``Partial Symmetries of Weak Interactions,''\n"
    result = latex._format_output_row('title', 'Partial Symmetries of Weak Interactions')

    assert expected == result
예제 #26
0
def test_format_output_row_more_than_eight_authors_collaboration_an_empty_list():
    collaboration_an_empty_list = Record({'collaboration': []})
    latex = Latex(collaboration_an_empty_list, 'latex_eu')

    expected = '  0 {\\it et al.}'
    result = latex._format_output_row('author', [str(i) for i in range(9)])

    assert expected == result
예제 #27
0
def test_format_output_row_publi_info_not_a_list():
    record = InspireRecord({})
    latex = Latex(record, 'latex_eu')

    expected = u'  Phys. Lett. 12 (1964) 132-133.\n'
    result = latex._format_output_row('publi_info', 'Phys. Lett. 12 (1964) 132-133')

    assert expected == result
예제 #28
0
def test_format_output_row_report_number():
    record = Record({})
    latex = Latex(record, 'latex_eu')

    expected = u'  CMS-PAS-TOP-13-007.\n'
    result = latex._format_output_row('report_number', 'CMS-PAS-TOP-13-007')

    assert expected == result
예제 #29
0
def test_get_title_no_titles():
    no_titles = Record({})
    latex = Latex(no_titles, 'latex_eu')

    expected = ''
    result = latex._get_title()

    assert expected == result
예제 #30
0
def test_get_author_from_authors_an_empty_list():
    authors_an_empty_list = Record({'authors': []})
    latex = Latex(authors_an_empty_list, 'latex_eu')

    expected = []
    result = latex._get_author()

    assert expected == result
예제 #31
0
def test_format_output_row_more_than_eight_authors_collaboration_an_empty_list():
    collaboration_an_empty_list = InspireRecord({'collaboration': []})
    latex = Latex(collaboration_an_empty_list, 'latex_eu')

    expected = '  0 {\\it et al.}'
    result = latex._format_output_row('author', [str(i) for i in range(9)])

    assert expected == result
예제 #32
0
def test_format_output_row_arxiv_with_publi_info():
    with_publi_info = {'publication_info': [{'journal_title': ''}]}
    latex = Latex(with_publi_info, 'latex_eu')

    expected = u'  [arXiv:1512.01381 [hep-th]].\n'
    result = latex._format_output_row('arxiv', 'arXiv:1512.01381 [hep-th]')

    assert expected == result
예제 #33
0
def test_format_output_row_report_number():
    record = InspireRecord({})
    latex = Latex(record, 'latex_eu')

    expected = u'  CMS-PAS-TOP-13-007.\n'
    result = latex._format_output_row('report_number', 'CMS-PAS-TOP-13-007')

    assert expected == result
예제 #34
0
def test_get_author_from_corporate_author_a_list_with_two_elements():
    corporate_author_a_list_of_two_elements = InspireRecord(
        {'corporate_author': ['CMS Collaboration', 'The ATLAS Collaboration']})
    latex = Latex(corporate_author_a_list_of_two_elements, 'latex_eu')

    expected = ['CMS Collaboration', 'The ATLAS Collaboration']
    result = latex._get_author()

    assert expected == result
예제 #35
0
def test_format_output_row_publi_info_a_list_with_one_element():
    record = {}
    latex = Latex(record, 'latex_eu')

    expected = u'  Phys.\\ Rev.\\ D {\\bf 73} (2006) 014022\n'
    result = latex._format_output_row(
        'publi_info', ['Phys.\\ Rev.\\ D {\\bf 73} (2006) 014022'])

    assert expected == result
예제 #36
0
def test_get_publi_info_from_publication_info_with_journal_title_an_empty_list(
):
    journal_title_an_empty_list = {'publication_info': [{'journal_title': []}]}
    latex = Latex(journal_title_an_empty_list, 'latex_eu')

    expected = []
    result = latex._get_publi_info()

    assert expected == result
예제 #37
0
def test_get_author_from_corporate_author_a_list_with_one_element():
    corporate_author_a_list_of_one_element = Record(
        {'corporate_author': ['CMS Collaboration']})
    latex = Latex(corporate_author_a_list_of_one_element, 'latex_eu')

    expected = ['CMS Collaboration']
    result = latex._get_author()

    assert expected == result
예제 #38
0
def test_format_output_row_publi_info_a_list_with_one_element():
    record = Record({})
    latex = Latex(record, 'latex_eu')

    expected = u'  Phys.\\ Rev.\\ D {\\bf 73} (2006) 014022\n'
    result = latex._format_output_row('publi_info', [
        'Phys.\\ Rev.\\ D {\\bf 73} (2006) 014022'
    ])

    assert expected == result
예제 #39
0
def test_get_author_from_authors_one_author_with_a_list_of_two_full_names():
    one_author_with_a_list_of_two_full_names = InspireRecord(
        {'authors': [{
            'full_name': ['Englert, F.', 'Brout, R.']
        }]})
    latex = Latex(one_author_with_a_list_of_two_full_names, 'latex_eu')

    expected = ['F.~B.~Englert, R.']
    result = latex._get_author()

    assert expected == result
예제 #40
0
def test_format_output_row_more_than_eight_authors_no_collaboration():
    without_collaboration = InspireRecord({})
    latex = Latex(without_collaboration, 'latex_eu')

    expected = u'  L.~Cadamuro {\it et al.},\n'
    result = latex._format_output_row('author', [
        'L.~Cadamuro', 'M.~Calvi', 'L.~Cassina', 'A.~Giachero', 'C.~Gotti',
        'B.~Khanji', 'M.~Maino', 'C.~Matteuzzi', 'G.~Pessina'
    ])

    assert expected == result
예제 #41
0
def test_get_publi_info_from_publication_info_with_journal_title_not_a_list():
    journal_title_not_a_list = InspireRecord(
        {'publication_info': [{
            'journal_title': 'Nucl.Phys.'
        }]})
    latex = Latex(journal_title_not_a_list, 'latex_eu')

    expected = ['Nucl.\\ Phys.\\ ']
    result = latex._get_publi_info()

    assert expected == result
예제 #42
0
def test_get_title_from_titles_not_a_list():
    titles_not_a_list = InspireRecord(
        {'titles': {
            'title': 'Partial Symmetries of Weak Interactions'
        }})
    latex = Latex(titles_not_a_list, 'latex_eu')

    expected = 'Partial Symmetries of Weak Interactions'
    result = latex._get_title()

    assert expected == result
예제 #43
0
def test_get_author_from_authors_one_author_with_a_list_of_one_full_name():
    one_author_with_a_list_of_one_full_name = InspireRecord(
        {'authors': [{
            'full_name': ['Glashow, S.L.']
        }]})
    latex = Latex(one_author_with_a_list_of_one_full_name, 'latex_eu')

    expected = ['S.~L.~Glashow']
    result = latex._get_author()

    assert expected == result
예제 #44
0
def test_get_author_from_authors_a_list_with_one_element():
    authors_a_list_with_one_element = InspireRecord(
        {'authors': [{
            'full_name': 'Glashow, S.L.'
        }]})
    latex = Latex(authors_a_list_with_one_element, 'latex_eu')

    expected = ['S.~L.~Glashow']
    result = latex._get_author()

    assert expected == result
예제 #45
0
def test_format_output_row_more_than_eight_authors_no_collaboration():
    without_collaboration = Record({})
    latex = Latex(without_collaboration, 'latex_eu')

    expected = u'  L.~Cadamuro {\it et al.},\n'
    result = latex._format_output_row('author', [
        'L.~Cadamuro', 'M.~Calvi', 'L.~Cassina', 'A.~Giachero', 'C.~Gotti',
        'B.~Khanji', 'M.~Maino', 'C.~Matteuzzi', 'G.~Pessina'
    ])

    assert expected == result
예제 #46
0
def test_get_author_from_authors_one_author_with_an_empty_list_of_full_names():
    one_author_with_an_empty_list_of_full_names = InspireRecord(
        {'authors': [{
            'full_name': []
        }]})
    latex = Latex(one_author_with_an_empty_list_of_full_names, 'latex_eu')

    expected = []
    result = latex._get_author()

    assert expected == result
예제 #47
0
def test_get_title_from_titles_a_list_with_one_element():
    titles_a_list_with_one_element = InspireRecord(
        {'titles': [{
            'title': 'Partial Symmetries of Weak Interactions'
        }]})
    latex = Latex(titles_a_list_with_one_element, 'latex_eu')

    expected = 'Partial Symmetries of Weak Interactions'
    result = latex._get_title()

    assert expected == result
예제 #48
0
def test_get_publi_info_from_publication_info_with_journal_title_a_list_of_one_element():
    journal_title_a_list_of_one_element = InspireRecord({
        'publication_info': [
            {'journal_title': ['foo']}
        ]
    })
    latex = Latex(journal_title_a_list_of_one_element, 'latex_eu')

    expected = ['foo']
    result = latex._get_publi_info()

    assert expected == result
예제 #49
0
def test_get_publi_info_from_publication_info_with_journal_title_not_a_list():
    journal_title_not_a_list = Record({
        'publication_info': [
            {'journal_title': 'Nucl.Phys.'}
        ]
    })
    latex = Latex(journal_title_not_a_list, 'latex_eu')

    expected = ['Nucl.\\ Phys.\\ ']
    result = latex._get_publi_info()

    assert expected == result
예제 #50
0
def test_format_output_row_arxiv_with_publi_info():
    with_publi_info = Record({
        'publication_info': [
            {'journal_title': ''}
        ]
    })
    latex = Latex(with_publi_info, 'latex_eu')

    expected = u'  [arXiv:1512.01381 [hep-th]].\n'
    result = latex._format_output_row('arxiv', 'arXiv:1512.01381 [hep-th]')

    assert expected == result
예제 #51
0
def test_get_author_from_authors_a_list_with_one_element():
    authors_a_list_with_one_element = Record({
        'authors': [
            {'full_name': 'Glashow, S.L.'}
        ]
    })
    latex = Latex(authors_a_list_with_one_element, 'latex_eu')

    expected = ['S.~L.~Glashow']
    result = latex._get_author()

    assert expected == result
예제 #52
0
def test_get_title_from_titles_not_a_list():
    titles_not_a_list = Record({
        'titles': {
            'title': 'Partial Symmetries of Weak Interactions'
        }
    })
    latex = Latex(titles_not_a_list, 'latex_eu')

    expected = 'Partial Symmetries of Weak Interactions'
    result = latex._get_title()

    assert expected == result
예제 #53
0
def test_get_author_from_corporate_author_a_list_with_one_element():
    corporate_author_a_list_of_one_element = Record({
        'corporate_author': [
            'CMS Collaboration'
        ]
    })
    latex = Latex(corporate_author_a_list_of_one_element, 'latex_eu')

    expected = ['CMS Collaboration']
    result = latex._get_author()

    assert expected == result
예제 #54
0
def test_get_title_from_titles_a_list_with_one_element():
    titles_a_list_with_one_element = Record({
        'titles': [
            {'title': 'Partial Symmetries of Weak Interactions'}
        ]
    })
    latex = Latex(titles_a_list_with_one_element, 'latex_eu')

    expected = 'Partial Symmetries of Weak Interactions'
    result = latex._get_title()

    assert expected == result
예제 #55
0
def test_get_publi_info_from_publication_info_with_journal_title_a_list_of_two_elements():
    journal_title_a_list_of_two_elements = Record({
        'publication_info': [
            {'journal_title': ['foo', 'bar']}
        ]
    })
    latex = Latex(journal_title_a_list_of_two_elements, 'latex_eu')

    expected = ['bar']
    result = latex._get_publi_info()

    assert expected == result
예제 #56
0
def test_get_author_from_authors_one_author_with_a_list_of_one_full_name():
    one_author_with_a_list_of_one_full_name = Record({
        'authors': [
            {'full_name': ['Glashow, S.L.']}
        ]
    })
    latex = Latex(one_author_with_a_list_of_one_full_name, 'latex_eu')

    expected = ['S.~L.~Glashow']
    result = latex._get_author()

    assert expected == result
예제 #57
0
def test_get_publi_info_from_pubinfo_freetext():
    pubinfo_freetext = Record({
        'publication_info': [
            {'pubinfo_freetext': 'Phys. Lett. 12 (1964) 132-133'}
        ]
    })
    latex = Latex(pubinfo_freetext, 'latex_eu')

    expected = 'Phys. Lett. 12 (1964) 132-133'
    result = latex._get_publi_info()

    assert expected == result
예제 #58
0
def test_get_author_from_authors_one_author_with_an_empty_list_of_full_names():
    one_author_with_an_empty_list_of_full_names = Record({
        'authors': [
            {'full_name': []}
        ]
    })
    latex = Latex(one_author_with_an_empty_list_of_full_names, 'latex_eu')

    expected = []
    result = latex._get_author()

    assert expected == result
예제 #59
0
def test_get_publi_info_from_publication_info_with_journal_title_an_empty_list():
    journal_title_an_empty_list = Record({
        'publication_info': [
            {'journal_title': []}
        ]
    })
    latex = Latex(journal_title_an_empty_list, 'latex_eu')

    expected = []
    result = latex._get_publi_info()

    assert expected == result
예제 #60
0
def test_get_title_from_titles_a_list_with_two_elements():
    titles_a_list_with_two_elements = Record({
        'titles': [
            {'title': 'Broken Symmetries and the Masses of Gauge Bosons'},
            {'title': 'BROKEN SYMMETRIES AND THE MASSES OF GAUGE BOSONS.'}
        ]
    })
    latex = Latex(titles_a_list_with_two_elements, 'latex_eu')

    expected = 'Broken Symmetries and the Masses of Gauge Bosons'
    result = latex._get_title()

    assert expected == result