Exemplo n.º 1
0
 def test_string_parse_accept_chars(self):
     bibtex_str = '@string{pub-ieee-std = {IEEE}}\n\n@string{pub-ieee-std:adr = {New York, NY, USA}}'
     bib_database = bibdeskparser.loads(bibtex_str)
     self.assertEqual(len(bib_database.strings), 2)
     expected = OrderedDict()
     expected['pub-ieee-std'] = 'IEEE'
     expected['pub-ieee-std:adr'] = 'New York, NY, USA'
     self.assertEqual(bib_database.strings, expected)
Exemplo n.º 2
0
 def test_multiple_string_parse(self):
     bibtex_str = (
         '@string{name1 = "value1"}\n\n@string{name2 = "value2"}\n\n'
     )
     bib_database = bibdeskparser.loads(bibtex_str)
     expected = OrderedDict()
     expected['name1'] = 'value1'
     expected['name2'] = 'value2'
     self.assertEqual(bib_database.strings, expected)
Exemplo n.º 3
0
 def test_unicode_problems(self):
     # See #51
     bibtex = """
     @article{Mesa-Gresa2013,
         abstract = {During a 4-week period half the mice (n = 16) were exposed to EE and the other half (n = 16) remained in a standard environment (SE). Aggr. Behav. 9999:XX-XX, 2013. © 2013 Wiley Periodicals, Inc.},
         author = {Mesa-Gresa, Patricia and P\'{e}rez-Martinez, Asunci\'{o}n and Redolat, Rosa},
         doi = {10.1002/ab.21481},
         file = {:Users/jscholz/Documents/mendeley/Mesa-Gresa, P\'{e}rez-Martinez, Redolat - 2013 - Environmental Enrichment Improves Novel Object Recognition and Enhances Agonistic Behavior.pdf:pdf},
         issn = {1098-2337},
         journal = {Aggressive behavior},
         month = "apr",
         number = {April},
         pages = {269--279},
         pmid = {23588702},
         title = {{Environmental Enrichment Improves Novel Object Recognition and Enhances Agonistic Behavior in Male Mice.}},
         url = {http://www.ncbi.nlm.nih.gov/pubmed/23588702},
         volume = {39},
         year = {2013}
     }
     """
     bibdb = bibdeskparser.loads(bibtex)
     with tempfile.TemporaryFile(mode='w+') as bibtex_file:
         bibdeskparser.dump(bibdb, bibtex_file)
Exemplo n.º 4
0
 def test_single_string_parse(self):
     bibtex_str = '@string{name1 = "value1"}\n\n'
     bib_database = bibdeskparser.loads(bibtex_str)
     expected = {'name1': 'value1'}
     self.assertEqual(bib_database.strings, expected)
Exemplo n.º 5
0
 def test_multiple_string_parse_count(self):
     bibtex_str = (
         '@string{name1 = "value1"}\n\n@string{name2 = "value2"}\n\n'
     )
     bib_database = bibdeskparser.loads(bibtex_str)
     self.assertEqual(len(bib_database.strings), 2)
Exemplo n.º 6
0
 def test_single_string_parse_count(self):
     bibtex_str = '@string{name1 = "value1"}\n\n'
     bib_database = bibdeskparser.loads(bibtex_str)
     self.assertEqual(len(bib_database.strings), 1)
Exemplo n.º 7
0
 def test_parse_str_module(self):
     with open(self.input_file_path) as bibtex_file:
         bibtex_str = bibtex_file.read()
     bibtex_database = bibdeskparser.loads(bibtex_str)
     self.assertEqual(bibtex_database.entries, self.entries_expected)
Exemplo n.º 8
0
 def test_single_preamble_parse_count(self):
     bibtex_str = '@preamble{" a "}\n\n'
     bib_database = bibdeskparser.loads(bibtex_str)
     self.assertEqual(len(bib_database.preambles), 1)
Exemplo n.º 9
0
 def test_multiple_preamble_parse(self):
     bibtex_str = '@preamble{" a "}\n\n@preamble{"b"}\n\n'
     bib_database = bibdeskparser.loads(bibtex_str)
     expected = [' a ', 'b']
     self.assertEqual(bib_database.preambles, expected)