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
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
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
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
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
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
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
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
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
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
def test_get_publi_info_from_publication_info_with_journal_title_a_list_of_two_elements():
    journal_title_a_list_of_two_elements = InspireRecord({
        '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
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
def test_get_publi_info_from_pubinfo_freetext():
    pubinfo_freetext = InspireRecord({
        '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
Exemple #14
0
def test_get_publi_info_from_publication_info_with_journal_title_a_list_of_one_element():
    journal_title_a_list_of_one_element = Record({
        '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
def test_get_publi_info_from_publication_info_with_year_an_empty_list():
    year_an_empty_list = InspireRecord(
        {'publication_info': [{
            'journal_title': 'Phys.Rev.',
            'year': []
        }]})
    latex = Latex(year_an_empty_list, 'latex_eu')

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

    assert expected == result
def test_get_publi_info_from_publication_info_with_page_start():
    page_start = InspireRecord(
        {'publication_info': [{
            'journal_title': 'JHEP',
            'page_start': '190'
        }]})
    latex = Latex(page_start, 'latex_eu')

    expected = ['JHEP 190']
    result = latex._get_publi_info()

    assert expected == result
def test_get_publi_info_from_publication_info_with_journal_issue_latex_us():
    journal_issue = {
        'publication_info': [{
            'journal_title': 'Class.Quant.Grav.',
            'journal_issue': '10'
        }]
    }
    latex_us = Latex(journal_issue, 'latex_us')

    expected = ['Class.\\ Quant.\\ Grav.\\ , no. 10']
    result = latex_us._get_publi_info()

    assert expected == result
def test_get_publi_info_from_publication_info_with_journal_issue_latex_eu():
    journal_issue = {
        'publication_info': [{
            'journal_title': 'Int.J.Mod.Phys.',
            'journal_issue': '29'
        }]
    }
    latex_eu = Latex(journal_issue, 'latex_eu')

    expected = ['Int.\\ J.\\ Mod.\\ Phys.\\  29, ']
    result = latex_eu._get_publi_info()

    assert expected == result
def test_get_publi_info_from_publication_info_with_year_not_a_list():
    year_not_a_list = {
        'publication_info': [{
            'journal_title': 'Phys.Lett.',
            'year': '1999'
        }]
    }
    latex = Latex(year_not_a_list, 'latex_eu')

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

    assert expected == result
def test_get_publi_info_from_publication_info_with_journal_volume():
    journal_volume = {
        'publication_info': [{
            'journal_title': 'eConf',
            'journal_volume': 'C050318'
        }]
    }
    latex = Latex(journal_volume, 'latex_eu')

    expected = ['eConf C {\\bf 050318}']
    result = latex._get_publi_info()

    assert expected == result
def test_get_publi_info_from_publication_info_with_year_a_list_of_one_element(
):
    year_a_list_of_one_element = InspireRecord(
        {'publication_info': [{
            'journal_title': 'JHEP',
            'year': ['1999']
        }]})
    latex = Latex(year_a_list_of_one_element, 'latex_eu')

    expected = ['JHEP (1999)']
    result = latex._get_publi_info()

    assert expected == result
def test_get_publi_info_from_publication_info_with_year_a_list_of_two_elements(
):
    year_a_list_of_two_elements = {
        'publication_info': [{
            'journal_title': 'Phys.Rev.Lett.',
            'year': ['1999', '2000']
        }]
    }
    latex = Latex(year_a_list_of_two_elements, 'latex_eu')

    expected = ['Phys.\\ Rev.\\ Lett.\\  (2000)']
    result = latex._get_publi_info()

    assert expected == result
def test_get_publi_info_from_publication_info_with_journal_volume_with_letter(
):
    journal_volume_with_letter = {
        'publication_info': [{
            'journal_title': 'Eur.Phys.J.',
            'journal_volume': 'C73'
        }]
    }
    latex = Latex(journal_volume_with_letter, 'latex_eu')

    expected = ['Eur.\\ Phys.\\ J.\\ C {\\bf 73}']
    result = latex._get_publi_info()

    assert expected == result
Exemple #24
0
def test_get_publi_info_from_publication_info_with_page_artid_an_empty_list():
    page_artid_an_empty_list = Record({
        'publication_info': [
            {
                'journal_title': 'Phys.Lett.',
                'page_artid': []
            }
        ]
    })
    latex = Latex(page_artid_an_empty_list, 'latex_eu')

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

    assert expected == result
def test_get_publi_info_from_publication_info_with_page_start():
    page_start = Record({
        'publication_info': [
            {
                'journal_title': 'JHEP',
                'page_start': '190'
            }
        ]
    })
    latex = Latex(page_start, 'latex_eu')

    expected = ['JHEP 190']
    result = latex._get_publi_info()

    assert expected == result
def test_get_publi_info_from_publication_info_with_journal_issue_latex_us():
    journal_issue = Record({
        'publication_info': [
            {
                'journal_title': 'Class.Quant.Grav.',
                'journal_issue': '10'
            }
        ]
    })
    latex_us = Latex(journal_issue, 'latex_us')

    expected = ['Class.\\ Quant.\\ Grav.\\ , no. 10']
    result = latex_us._get_publi_info()

    assert expected == result
def test_get_publi_info_from_publication_info_with_year_a_list_of_two_elements():
    year_a_list_of_two_elements = Record({
        'publication_info': [
            {
                'journal_title': 'Phys.Rev.Lett.',
                'year': ['1999', '2000']
            }
        ]
    })
    latex = Latex(year_a_list_of_two_elements, 'latex_eu')

    expected = ['Phys.\\ Rev.\\ Lett.\\  (2000)']
    result = latex._get_publi_info()

    assert expected == result
def test_get_publi_info_from_publication_info_with_year_a_list_of_one_element():
    year_a_list_of_one_element = Record({
        'publication_info': [
            {
                'journal_title': 'JHEP',
                'year': ['1999']
            }
        ]
    })
    latex = Latex(year_a_list_of_one_element, 'latex_eu')

    expected = ['JHEP (1999)']
    result = latex._get_publi_info()

    assert expected == result
def test_get_publi_info_from_publication_info_with_year_an_empty_list():
    year_an_empty_list = Record({
        'publication_info': [
            {
                'journal_title': 'Phys.Rev.',
                'year': []
            }
        ]
    })
    latex = Latex(year_an_empty_list, 'latex_eu')

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

    assert expected == result
def test_get_publi_info_from_publication_info_with_year_not_a_list():
    year_not_a_list = Record({
        'publication_info': [
            {
                'journal_title': 'Phys.Lett.',
                'year': '1999'
            }
        ]
    })
    latex = Latex(year_not_a_list, 'latex_eu')

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

    assert expected == result
def test_get_publi_info_from_publication_info_with_journal_volume_with_letter():
    journal_volume_with_letter = Record({
        'publication_info': [
            {
                'journal_title': 'Eur.Phys.J.',
                'journal_volume': 'C73'
            }
        ]
    })
    latex = Latex(journal_volume_with_letter, 'latex_eu')

    expected = ['Eur.\\ Phys.\\ J.\\ C {\\bf 73}']
    result = latex._get_publi_info()

    assert expected == result
Exemple #32
0
def test_get_publi_info_from_publication_info_with_page_artid_a_list_of_one_element():
    page_artid_a_list_of_one_element = Record({
        'publication_info': [
            {
                'journal_title': 'Eur.Phys.J.',
                'page_artid': ['2466']
            }
        ]
    })
    latex = Latex(page_artid_a_list_of_one_element, 'latex_eu')

    expected = ['Eur.\\ Phys.\\ J.\\  2466']
    result = latex._get_publi_info()

    assert expected == result
def test_get_publi_info_from_publication_info_with_journal_issue_latex_eu():
    journal_issue = Record({
        'publication_info': [
            {
                'journal_title': 'Int.J.Mod.Phys.',
                'journal_issue': '29'
            }
        ]
    })
    latex_eu = Latex(journal_issue, 'latex_eu')

    expected = ['Int.\\ J.\\ Mod.\\ Phys.\\  29, ']
    result = latex_eu._get_publi_info()

    assert expected == result
def test_get_publi_info_from_publication_info_with_journal_volume():
    journal_volume = Record({
        'publication_info': [
            {
                'journal_title': 'eConf',
                'journal_volume': 'C050318'
            }
        ]
    })
    latex = Latex(journal_volume, 'latex_eu')

    expected = ['eConf C {\\bf 050318}']
    result = latex._get_publi_info()

    assert expected == result
Exemple #35
0
def test_get_publi_info_from_publication_info_with_page_artid_not_a_list():
    page_artid_not_a_list = Record({
        'publication_info': [
            {
                'journal_title': 'JHEP',
                'page_artid': '190'
            }
        ]
    })
    latex = Latex(page_artid_not_a_list, 'latex_eu')

    expected = ['JHEP 190']
    result = latex._get_publi_info()

    assert expected == result
Exemple #36
0
def test_get_publi_info_from_publication_info_with_page_artid_a_list_of_two_elements():
    page_artid_a_list_of_two_elements = Record({
        'publication_info': [
            {
                'journal_title': 'Phys.Rev.Lett.',
                'page_artid': [
                    '321-323',
                    '1-188'
                ]
            }
        ]
    })
    latex = Latex(page_artid_a_list_of_two_elements, 'latex_eu')

    expected = ['Phys.\\ Rev.\\ Lett.\\  1']
    result = latex._get_publi_info()

    assert expected == result
def test_get_publi_info_no_publication_info():
    no_publication_info = Record({})
    latex = Latex(no_publication_info, 'latex_eu')

    assert latex._get_publi_info() is None
def test_get_publi_info_no_publication_info():
    no_publication_info = {}
    latex = Latex(no_publication_info, 'latex_eu')

    assert latex._get_publi_info() is None
def test_get_publi_info_no_publication_info():
    no_publication_info = InspireRecord({})
    latex = Latex(no_publication_info, 'latex_eu')

    assert latex._get_publi_info() is None