Пример #1
0
    def test_simple(self):
        bibentry = copy.deepcopy(fixtures.doe_bibentry)
        key = bibstruct.generate_citekey(bibentry)
        self.assertEqual(key, 'Doe2013')

        bibentry = copy.deepcopy(fixtures.franny_bibentry)
        key = bibstruct.generate_citekey(bibentry)
        self.assertEqual(key, 'Salinger1961')
Пример #2
0
    def test_simple(self):
        bibentry = copy.deepcopy(fixtures.doe_bibentry)
        key = bibstruct.generate_citekey(bibentry)
        self.assertEqual(key, 'Doe2013')

        bibentry = copy.deepcopy(fixtures.franny_bibentry)
        key = bibstruct.generate_citekey(bibentry)
        self.assertEqual(key, 'Salinger1961')
Пример #3
0
    def test_u_modifier(self):
        template = '{author_last_name:u}{year:u}'
        bibentry = copy.deepcopy(fixtures.doe_bibentry)
        key = bibstruct.generate_citekey(bibentry, template)
        self.assertEqual(key, 'DOE2013')

        bibentry = copy.deepcopy(fixtures.franny_bibentry)
        key = bibstruct.generate_citekey(bibentry, template)
        self.assertEqual(key, 'SALINGER1961', template)
Пример #4
0
    def test_l_modifier(self):
        template = '{author_last_name:l}{year:l}'
        bibentry = copy.deepcopy(fixtures.doe_bibentry)
        key = bibstruct.generate_citekey(bibentry, template)
        self.assertEqual(key, 'doe2013')

        bibentry = copy.deepcopy(fixtures.franny_bibentry)
        key = bibstruct.generate_citekey(bibentry, template)
        self.assertEqual(key, 'salinger1961')
Пример #5
0
    def test_all_keys(self):
        template = '{author_last_name}-{year}-{short_title}'
        bibentry = copy.deepcopy(fixtures.doe_bibentry)
        key = bibstruct.generate_citekey(bibentry, template)
        self.assertEqual(key, 'Doe-2013-Nice')

        bibentry = copy.deepcopy(fixtures.franny_bibentry)
        key = bibstruct.generate_citekey(bibentry, template)
        self.assertEqual(key, 'Salinger-1961-Franny')
Пример #6
0
 def test_escapes_chars(self):
     doe_bibentry = copy.deepcopy(fixtures.doe_bibentry)
     citekey, bibdata = bibstruct.get_entry(doe_bibentry)
     bibdata['author'] = ['Zôu\\@/ , John']
     key = bibstruct.generate_citekey(doe_bibentry)
     self.assertEqual(key, 'Zou2013')
Пример #7
0
 def test_fails_on_empty_paper(self):
     with self.assertRaises(ValueError):
         bibstruct.generate_citekey(None)
Пример #8
0
 def test_escapes_chars(self):
     doe_bibentry = copy.deepcopy(fixtures.doe_bibentry)
     citekey, bibdata = bibstruct.get_entry(doe_bibentry)
     bibdata['author'] = ['Zôu\\@/ , John']
     key = bibstruct.generate_citekey(doe_bibentry)
     self.assertEqual(key, 'Zou2013')
Пример #9
0
 def test_fails_on_empty_paper(self):
     with self.assertRaises(ValueError):
         bibstruct.generate_citekey(None)