def test_standard_abbrev_long(): journals = [FULL_PNAS] abbrevs = [PNAS_ABBREV] for journal, abbrev in zip(journals, abbrevs): entries = make_fake_entry(abbrev) betterbib.journal_abbrev(entries, long_journal_names=True) assert entries["foo"].fields["journal"] == journal
def test_standard_abbrev(): journals = [FULL_PNAS] abbrevs = [PNAS_ABBREV] for journal, abbrev in zip(journals, abbrevs): entries = make_fake_entry(journal) betterbib.journal_abbrev(entries) assert entries["foo"].fields["journal"] == abbrev
def test_custom_abbrev_long(): infile = tempfile.NamedTemporaryFile().name super_short = '{"' + FULL_PNAS + ': "PNAS"}' with open(infile, "w") as f: f.write(super_short) entries = make_fake_entry(PNAS_ABBREV) betterbib.journal_abbrev(entries, long_journal_names=True) assert entries["foo"].fields["journal"] == FULL_PNAS
def test_custom_abbrev(): infile = tempfile.NamedTemporaryFile().name super_short = '{"PNAS": "' + PNAS_ABBREV + '"}' with open(infile, "w") as f: f.write(super_short) entries = make_fake_entry("PNAS") betterbib.journal_abbrev(entries, custom_abbrev=infile) assert entries["foo"].fields["journal"] == PNAS_ABBREV super_short = '{"' + FULL_PNAS + '": "PNAS"}' with open(infile, "w") as f: f.write(super_short) entries = make_fake_entry(FULL_PNAS) betterbib.journal_abbrev(entries, custom_abbrev=infile) assert entries["foo"].fields["journal"] == "PNAS"
def test_journal_name(): shrt = pybtex.database.Entry( "article", fields={"journal": "SIAM J. Matrix Anal. Appl."} ) lng = pybtex.database.Entry( "article", fields={"journal": "SIAM Journal on Matrix Analysis and Applications"}, ) tmp = betterbib.journal_abbrev({"key": lng}) assert tmp["key"].fields["journal"] == shrt.fields["journal"] lng = pybtex.database.Entry( "article", fields={"journal": "SIAM Journal on Matrix Analysis and Applications"}, ) tmp = betterbib.journal_abbrev({"key": shrt}, long_journal_names=True) assert tmp["key"].fields["journal"] == lng.fields["journal"]