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 } ] }) cv_latex_html_text = Cv_latex_html_text( publication_info_a_list_of_two_elements, 'cv_latex_html_text', ',') expected = [ 'Int.J.Theor.Phys. 38 (1999) 1113-1133', 'Adv.Theor.Math.Phys. 2 (1998) 231-252' ] result = cv_latex_html_text._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 = 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 }] }) cv_latex_html_text = Cv_latex_html_text( publication_info_a_list_of_two_elements, 'cv_latex_html_text', ',') expected = [ 'Int.J.Theor.Phys. 38 (1999) 1113-1133', 'Adv.Theor.Math.Phys. 2 (1998) 231-252' ] result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_title_capitalizes_when_title_contains_uppercase_the(): title_contains_uppercase_the = {'titles': [{'title': 'foo THE bar'}]} cv_latex_html_text = Cv_latex_html_text(title_contains_uppercase_the, 'cv_latex_html_text', ',') expected = 'Foo The Bar' result = cv_latex_html_text._get_title() assert expected == result
def test_get_author_from_corporate_author_an_empty_list(): corporate_author_an_empty_list = InspireRecord({'corporate_author': []}) cv_latex_html_text = Cv_latex_html_text( corporate_author_an_empty_list, 'cv_latex_html_text', ',') expected = [] result = cv_latex_html_text._get_author() assert expected == result
def test_get_title_returns_empty_string_when_no_titles(): no_titles = Record({}) cv_latex_html_text = Cv_latex_html_text(no_titles, 'cv_latex_html_text', ',') expected = '' result = cv_latex_html_text._get_title() assert expected == result
def test_get_title_when_titles_is_not_a_list_without_subtitles(): titles_not_a_list_without_subtitles = Record({'titles': {'title': 'foo'}}) cv_latex_html_text = Cv_latex_html_text( titles_not_a_list_without_subtitles, 'cv_latex_html_text', ',') expected = 'foo' result = cv_latex_html_text._get_title() assert expected == result
def test_get_title_returns_empty_string_when_titles_is_an_empty_list(): titles_an_empty_list = Record({'titles': []}) cv_latex_html_text = Cv_latex_html_text(titles_an_empty_list, 'cv_latex_html_text', ',') expected = '' result = cv_latex_html_text._get_title() assert expected == result
def test_get_title_capitalizes_when_title_is_uppercase(): title_is_uppercase = Record({'titles': [{'title': 'FOO'}]}) cv_latex_html_text = Cv_latex_html_text(title_is_uppercase, 'cv_latex_html_text', ',') expected = 'Foo' result = cv_latex_html_text._get_title() assert expected == result
def test_get_title_returns_empty_string_when_no_titles(): no_titles = InspireRecord({}) cv_latex_html_text = Cv_latex_html_text( no_titles, 'cv_latex_html_text', ',') expected = '' result = cv_latex_html_text._get_title() assert expected == result
def test_get_publi_info_from_publication_info_an_empty_list(): publication_info_an_empty_list = InspireRecord({'publication_info': []}) cv_latex_html_text = Cv_latex_html_text( publication_info_an_empty_list, 'cv_latex_html_text', ',') expected = [] result = cv_latex_html_text._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': []}) cv_latex_html_text = Cv_latex_html_text(publication_info_an_empty_list, 'cv_latex_html_text', ',') expected = [] result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_author_from_corporate_author_an_empty_list(): corporate_author_an_empty_list = Record({'corporate_author': []}) cv_latex_html_text = Cv_latex_html_text(corporate_author_an_empty_list, 'cv_latex_html_text', ',') expected = [] result = cv_latex_html_text._get_author() assert expected == result
def test_get_author_from_corporate_author_a_list_with_two_elements(): corporate_author_a_list_of_two_elements = Record( {'corporate_author': ['CMS Collaboration', 'The ATLAS Collaboration']}) cv_latex_html_text = Cv_latex_html_text( corporate_author_a_list_of_two_elements, 'cv_latex_html_text', ',') expected = ['CMS Collaboration', 'The ATLAS Collaboration'] result = cv_latex_html_text._get_author() assert expected == result
def test_get_author_from_corporate_author_a_list_with_one_element(): corporate_author_a_list_of_one_element = InspireRecord( {'corporate_author': ['CMS Collaboration']}) cv_latex_html_text = Cv_latex_html_text( corporate_author_a_list_of_one_element, 'cv_latex_html_text', ',') expected = ['CMS Collaboration'] result = cv_latex_html_text._get_author() assert expected == result
def test_get_title_returns_empty_string_when_titles_is_an_empty_list(): titles_an_empty_list = InspireRecord({ 'titles': [] }) cv_latex_html_text = Cv_latex_html_text( titles_an_empty_list, 'cv_latex_html_text', ',') expected = '' result = cv_latex_html_text._get_title() assert expected == result
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.'] }]}) cv_latex_html_text = Cv_latex_html_text( one_author_with_a_list_of_one_full_name, 'cv_latex_html', ',') expected = ['S.L. Glashow'] result = cv_latex_html_text._get_author() assert expected == result
def test_get_author_from_authors_one_author_with_a_list_of_two_full_names(): one_author_with_a_list_of_two_full_names = Record( {'authors': [{ 'full_name': ['Englert, F.', 'Brout, R.'] }]}) cv_latex_html_text = Cv_latex_html_text( one_author_with_a_list_of_two_full_names, 'cv_latex_html', ',') expected = ['F.Brout Englert, R.'] result = cv_latex_html_text._get_author() assert expected == result
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': [] }]}) cv_latex_html_text = Cv_latex_html_text( one_author_with_an_empty_list_of_full_names, 'cv_latex_html', ',') expected = [] result = cv_latex_html_text._get_author() assert expected == result
def test_get_publi_info_from_publication_info_with_journal_title(): journal_title = Record( {'publication_info': [{ 'journal_title': 'Nucl.Phys.' }]}) cv_latex_html_text = Cv_latex_html_text(journal_title, 'cv_latex_html_text', ',') expected = ['Submitted to: Nucl.Phys.'] result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_author_from_authors_a_list_with_one_element(): authors_a_list_with_one_element = Record( {'authors': [{ 'full_name': 'Glashow, S.L.' }]}) cv_latex_html_text = Cv_latex_html_text(authors_a_list_with_one_element, 'cv_latex_html', ',') expected = ['S.L. Glashow'] result = cv_latex_html_text._get_author() 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': [] }]}) cv_latex_html_text = Cv_latex_html_text(year_an_empty_list, 'cv_latex_html_text', ',') expected = ['Submitted to:Phys.Rev.'] result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_title_when_titles_is_a_list_of_one_element_without_subtitles(): titles_a_list_of_one_element_without_subtitles = Record({ 'titles': [ {'title': 'foo'} ] }) cv_latex_html_text = Cv_latex_html_text( titles_a_list_of_one_element_without_subtitles, 'cv_latex_html_text', ',') expected = 'foo' result = cv_latex_html_text._get_title() assert expected == result
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' }]}) cv_latex_html_text = Cv_latex_html_text(page_artid_not_a_list, 'cv_latex_html_text', ',') expected = ['JHEP 190'] result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_title_when_titles_is_a_list_of_one_element_with_subtitle(): titles_a_list_of_one_element_with_subtitle = Record( {'titles': [{ 'title': 'foo', 'subtitle': 'bar' }]}) cv_latex_html_text = Cv_latex_html_text( titles_a_list_of_one_element_with_subtitle, 'cv_latex_html_text', ',') expected = 'foo : bar' result = cv_latex_html_text._get_title() 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': []} ] }) cv_latex_html_text = Cv_latex_html_text( journal_title_an_empty_list, 'cv_latex_html_text', ',') expected = [] result = cv_latex_html_text._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']} ] }) cv_latex_html_text = Cv_latex_html_text( journal_title_a_list_of_two_elements, 'cv_latex_html_text', ',') expected = ['Submitted to:bar'] result = cv_latex_html_text._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': [] }]}) cv_latex_html_text = Cv_latex_html_text(journal_title_an_empty_list, 'cv_latex_html_text', ',') expected = [] result = cv_latex_html_text._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'] }]}) cv_latex_html_text = Cv_latex_html_text( journal_title_a_list_of_two_elements, 'cv_latex_html_text', ',') expected = ['Submitted to:bar'] result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_title_when_titles_is_a_list_of_one_element_without_subtitles(): titles_a_list_of_one_element_without_subtitles = InspireRecord( {'titles': [{ 'title': 'foo' }]}) cv_latex_html_text = Cv_latex_html_text( titles_a_list_of_one_element_without_subtitles, 'cv_latex_html_text', ',') expected = 'foo' result = cv_latex_html_text._get_title() assert expected == result
def test_get_title_when_titles_is_not_a_list_with_subtitle(): titles_not_a_list_with_subtitle = InspireRecord( {'titles': { 'title': 'foo', 'subtitle': 'bar' }}) cv_latex_html_text = Cv_latex_html_text(titles_not_a_list_with_subtitle, 'cv_latex_html_text', ',') expected = 'foo : bar' result = cv_latex_html_text._get_title() assert expected == result
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.']} ] }) cv_latex_html_text = Cv_latex_html_text( one_author_with_a_list_of_one_full_name, 'cv_latex_html', ',') expected = ['S.L. Glashow'] result = cv_latex_html_text._get_author() assert expected == result
def test_get_author_from_corporate_author_a_list_with_one_element(): corporate_author_a_list_of_one_element = InspireRecord({ 'corporate_author': [ 'CMS Collaboration' ] }) cv_latex_html_text = Cv_latex_html_text( corporate_author_a_list_of_one_element, 'cv_latex_html_text', ',') expected = ['CMS Collaboration'] result = cv_latex_html_text._get_author() 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' }]}) cv_latex_html_text = Cv_latex_html_text(page_start, 'cv_latex_html_text', ',') expected = ['Submitted to: JHEP'] result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_author_from_authors_a_list_with_one_element(): authors_a_list_with_one_element = InspireRecord({ 'authors': [ {'full_name': 'Glashow, S.L.'} ] }) cv_latex_html_text = Cv_latex_html_text( authors_a_list_with_one_element, 'cv_latex_html', ',') expected = ['S.L. Glashow'] result = cv_latex_html_text._get_author() assert expected == result
def test_get_title_capitalizes_when_title_contains_uppercase_the(): title_contains_uppercase_the = InspireRecord({ 'titles': [ {'title': 'foo THE bar'} ] }) cv_latex_html_text = Cv_latex_html_text( title_contains_uppercase_the, 'cv_latex_html_text', ',') expected = 'Foo The Bar' result = cv_latex_html_text._get_title() assert expected == result
def test_get_publi_info_from_pubinfo_freetext(): pubinfo_freetext = InspireRecord({ 'publication_info': [ {'pubinfo_freetext': 'Phys. Lett. 12 (1964) 132-133'} ] }) cv_latex_html_text = Cv_latex_html_text( pubinfo_freetext, 'cv_latex_html_text', ',') expected = 'Phys. Lett. 12 (1964) 132-133' result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_publi_info_from_publication_info_with_journal_title(): journal_title = InspireRecord({ 'publication_info': [ {'journal_title': 'Nucl.Phys.'} ] }) cv_latex_html_text = Cv_latex_html_text( journal_title, 'cv_latex_html_text', ',') expected = ['Submitted to: Nucl.Phys.'] result = cv_latex_html_text._get_publi_info() assert expected == result
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': []} ] }) cv_latex_html_text = Cv_latex_html_text( one_author_with_an_empty_list_of_full_names, 'cv_latex_html', ',') expected = [] result = cv_latex_html_text._get_author() assert expected == result
def test_get_title_when_titles_is_not_a_list_without_subtitles(): titles_not_a_list_without_subtitles = InspireRecord({ 'titles': { 'title': 'foo' } }) cv_latex_html_text = Cv_latex_html_text( titles_not_a_list_without_subtitles, 'cv_latex_html_text', ',') expected = 'foo' result = cv_latex_html_text._get_title() assert expected == result
def test_get_title_capitalizes_when_title_is_uppercase(): title_is_uppercase = InspireRecord({ 'titles': [ {'title': 'FOO'} ] }) cv_latex_html_text = Cv_latex_html_text( title_is_uppercase, 'cv_latex_html_text', ',') expected = 'Foo' result = cv_latex_html_text._get_title() assert expected == result
def test_get_author_from_corporate_author_a_list_with_two_elements(): corporate_author_a_list_of_two_elements = Record({ 'corporate_author': [ 'CMS Collaboration', 'The ATLAS Collaboration' ] }) cv_latex_html_text = Cv_latex_html_text( corporate_author_a_list_of_two_elements, 'cv_latex_html_text', ',') expected = ['CMS Collaboration', 'The ATLAS Collaboration'] result = cv_latex_html_text._get_author() assert expected == result
def test_get_title_when_titles_is_not_a_list_with_subtitle(): titles_not_a_list_with_subtitle = Record({ 'titles': { 'title': 'foo', 'subtitle': 'bar' } }) cv_latex_html_text = Cv_latex_html_text( titles_not_a_list_with_subtitle, 'cv_latex_html_text', ',') expected = 'foo : bar' result = cv_latex_html_text._get_title() 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' }] }) cv_latex_html_text = Cv_latex_html_text(journal_volume, 'cv_latex_html_text', ',') expected = ['eConf C050318'] result = cv_latex_html_text._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' }] }) cv_latex_html_text = Cv_latex_html_text(pubinfo_freetext, 'cv_latex_html_text', ',') expected = 'Phys. Lett. 12 (1964) 132-133' result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_publi_info_from_publication_info_with_year(): year_not_a_list = Record({ 'publication_info': [{ 'journal_title': 'Phys.Lett.', 'year': '1999' }] }) cv_latex_html_text = Cv_latex_html_text(year_not_a_list, 'cv_latex_html_text', ',') expected = ['Submitted to: Phys.Lett. (1999)'] result = cv_latex_html_text._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'] }]}) cv_latex_html_text = Cv_latex_html_text(year_a_list_of_one_element, 'cv_latex_html_text', ',') expected = ['Submitted to:JHEP (1999)'] result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_publi_info_from_publication_info_with_journal_issue(): journal_issue = Record({ 'publication_info': [{ 'journal_title': 'Class.Quant.Grav.', 'journal_issue': '10' }] }) cv_latex_html_text = Cv_latex_html_text(journal_issue, 'cv_latex_html_text', ',') expected = ['Submitted to: Class.Quant.Grav.'] result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_author_from_authors_a_list_with_two_elements(): authors_a_list_with_two_elements = InspireRecord({ 'authors': [ {'full_name': 'Englert, F.'}, {'full_name': 'Brout, R.'} ] }) cv_latex_html_text = Cv_latex_html_text( authors_a_list_with_two_elements, 'cv_latex_html', ',') expected = ['F. Englert', 'R. Brout'] result = cv_latex_html_text._get_author() assert expected == result
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': [] }] }) cv_latex_html_text = Cv_latex_html_text(page_artid_an_empty_list, 'cv_latex_html_text', ',') expected = ['Phys.Lett.'] result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_author_from_authors_a_list_with_two_elements(): authors_a_list_with_two_elements = Record({ 'authors': [{ 'full_name': 'Englert, F.' }, { 'full_name': 'Brout, R.' }] }) cv_latex_html_text = Cv_latex_html_text(authors_a_list_with_two_elements, 'cv_latex_html', ',') expected = ['F. Englert', 'R. Brout'] result = cv_latex_html_text._get_author() assert expected == result
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'] } ] }) cv_latex_html_text = Cv_latex_html_text( page_artid_a_list_of_one_element, 'cv_latex_html_text', ',') expected = ['Eur.Phys.J. 2466'] result = cv_latex_html_text._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' } ] }) cv_latex_html_text = Cv_latex_html_text( page_start, 'cv_latex_html_text', ',') expected = ['Submitted to: JHEP'] result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_publi_info_from_publication_info_with_journal_issue(): journal_issue = InspireRecord({ 'publication_info': [ { 'journal_title': 'Class.Quant.Grav.', 'journal_issue': '10' } ] }) cv_latex_html_text = Cv_latex_html_text( journal_issue, 'cv_latex_html_text', ',') expected = ['Submitted to: Class.Quant.Grav.'] result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_publi_info_from_publication_info_with_year(): year_not_a_list = InspireRecord({ 'publication_info': [ { 'journal_title': 'Phys.Lett.', 'year': '1999' } ] }) cv_latex_html_text = Cv_latex_html_text( year_not_a_list, 'cv_latex_html_text', ',') expected = ['Submitted to: Phys.Lett. (1999)'] result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_publi_info_from_publication_info_with_journal_volume_with_letter(): journal_volume_with_letter = InspireRecord({ 'publication_info': [ { 'journal_title': 'Eur.Phys.J.', 'journal_volume': 'C73' } ] }) cv_latex_html_text = Cv_latex_html_text( journal_volume_with_letter, 'cv_latex_html_text', ',') expected = ['Submitted to: Eur.Phys.J.'] result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_publi_info_from_publication_info_with_journal_volume(): journal_volume = InspireRecord({ 'publication_info': [ { 'journal_title': 'eConf', 'journal_volume': 'C050318' } ] }) cv_latex_html_text = Cv_latex_html_text( journal_volume, 'cv_latex_html_text', ',') expected = ['eConf C050318'] result = cv_latex_html_text._get_publi_info() assert expected == result
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': [] } ] }) cv_latex_html_text = Cv_latex_html_text( page_artid_an_empty_list, 'cv_latex_html_text', ',') expected = ['Phys.Lett.'] result = cv_latex_html_text._get_publi_info() assert expected == result
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' } ] }) cv_latex_html_text = Cv_latex_html_text( page_artid_not_a_list, 'cv_latex_html_text', ',') expected = ['JHEP 190'] result = cv_latex_html_text._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'] } ] }) cv_latex_html_text = Cv_latex_html_text( year_a_list_of_two_elements, 'cv_latex_html_text', ',') expected = ['Submitted to:Phys.Rev.Lett. (2000)'] result = cv_latex_html_text._get_publi_info() assert expected == result
def test_get_title_when_titles_is_a_list_of_one_element_with_subtitle(): titles_a_list_of_one_element_with_subtitle = InspireRecord({ 'titles': [ { 'title': 'foo', 'subtitle': 'bar' } ] }) cv_latex_html_text = Cv_latex_html_text( titles_a_list_of_one_element_with_subtitle, 'cv_latex_html_text', ',') expected = 'foo : bar' result = cv_latex_html_text._get_title() assert expected == result