diff --git a/pubs/bibstruct.py b/pubs/bibstruct.py index a8312b0..d3e6614 100644 --- a/pubs/bibstruct.py +++ b/pubs/bibstruct.py @@ -7,7 +7,7 @@ from .p3 import ustr, uchr # Citekey stuff -TYPE_KEY = 'type' +TYPE_KEY = 'ENTRYTYPE' CONTROL_CHARS = ''.join(map(uchr, list(range(0, 32)) + list(range(127, 160)))) CITEKEY_FORBIDDEN_CHARS = '@\'\\,#}{~%/ ' # '/' is OK for bibtex but forbidden diff --git a/tests/test_endecoder.py b/tests/test_endecoder.py index d9ade7f..858213f 100644 --- a/tests/test_endecoder.py +++ b/tests/test_endecoder.py @@ -57,6 +57,12 @@ class TestEnDecode(unittest.TestCase): self.assertEqual(bibraw1, bibraw2) + def test_decode_bibtex_preserves_type_field(self): + """Test that multiple encode/decode step preserve data""" + decoder = endecoder.EnDecoder() + entry = decoder.decode_bibdata(bibtex_raw0) + self.assertEqual(entry['Page99']['type'], "technical report") + def test_endecode_bibtex_BOM(self): """Test that bibtexparser if fine with BOM-prefixed data""" decoder = endecoder.EnDecoder()