Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 11
0
def test_get_title_no_titles():
    no_titles = {}
    latex = Latex(no_titles, 'latex_eu')

    expected = ''
    result = latex._get_title()

    assert expected == result
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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