Skip to content

Commit

Permalink
chore: Make newer bibtexparser versions work with the tests (ietf-too…
Browse files Browse the repository at this point in the history
…ls#4205)

* chore: Make newer bibtexparser versions work with the tests

* Fix test
  • Loading branch information
larseggert authored Jul 12, 2022
1 parent 57818a0 commit 495df36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions ietf/doc/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1828,7 +1828,7 @@ def test_document_nonietf_pubreq_button(self):
self.assertNotContains(r, "Request publication")

def _parse_bibtex_response(self, response) -> dict:
parser = bibtexparser.bparser.BibTexParser()
parser = bibtexparser.bparser.BibTexParser(common_strings=True)
parser.homogenise_fields = False # do not modify field names (e.g., turns "url" into "link" by default)
return bibtexparser.loads(response.content.decode(), parser=parser).get_entry_dict()

Expand All @@ -1850,7 +1850,7 @@ def test_document_bibtex(self):
self.assertEqual(entry['number'], num)
self.assertEqual(entry['doi'], '10.17487/RFC%s'%num)
self.assertEqual(entry['year'], '2010')
self.assertEqual(entry['month'], 'oct')
self.assertEqual(entry['month'].lower()[0:3], 'oct')
self.assertEqual(entry['url'], f'https://www.rfc-editor.ietf.org/info/rfc{num}')
#
self.assertNotIn('day', entry)
Expand All @@ -1872,7 +1872,7 @@ def test_document_bibtex(self):
self.assertEqual(entry['number'], num)
self.assertEqual(entry['doi'], '10.17487/RFC%s'%num)
self.assertEqual(entry['year'], '1990')
self.assertEqual(entry['month'], 'apr')
self.assertEqual(entry['month'].lower()[0:3], 'apr')
self.assertEqual(entry['day'], '1')
self.assertEqual(entry['url'], f'https://www.rfc-editor.ietf.org/info/rfc{num}')

Expand All @@ -1885,7 +1885,7 @@ def test_document_bibtex(self):
self.assertEqual(entry['note'], 'Work in Progress')
self.assertEqual(entry['number'], docname)
self.assertEqual(entry['year'], str(draft.pub_date().year))
self.assertEqual(entry['month'], draft.pub_date().strftime('%b').lower())
self.assertEqual(entry['month'].lower()[0:3], draft.pub_date().strftime('%b').lower())
self.assertEqual(entry['day'], str(draft.pub_date().day))
self.assertEqual(entry['url'], settings.IDTRACKER_BASE_URL + urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name, rev=draft.rev)))
#
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ setuptools>=51.1.0 # Require this first, to prevent later errors
#
argon2-cffi>=21.3.0 # For the Argon2 password hasher option
beautifulsoup4>=4.11.1 # Only used in tests
bibtexparser>=0.6.2,<1.0 # Only used in tests. Version 1.0 doesn't work under python 2.7. 1.0.1 doesn't recognize month names or abbreviations.
bibtexparser>=1.2.0 # Only used in tests
bleach>=5.0.0
coverage>=4.5.4,<5.0 # Coverage 5.x moves from a json database to SQLite. Moving to 5.x will require substantial rewrites in ietf.utils.test_runner and ietf.release.views
decorator>=5.1.1
Expand Down

0 comments on commit 495df36

Please sign in to comment.