New submission from Alejandro Javier Peralta Frías: New to python-dev; I grab a beginner tasks "increase test coverage" and I decided to add coverage to this bit of code in the quopri module:
# quopri.py L138 while n > 0 and line[n-1:n] in b" \t\r": L139 n = n-1 As far as I understand to get into that while-loop the line to decode should end in " \t\r\n". So the I added the following test: def test_decodestring_badly_enconded(self): e = b"hello \t\r\n" p = b"hello\n" s = self.module.decodestring(e) self.assertEqual(s, p) but that only passes when the module doesn't use binascii. In fact I change test_quopri to use support.import_fresh_module to disable binascii and removed a decorator that was used. The decode text when binascci is used is: >>> quopri.decodestring("hello \t\r\n") 'hello \t\r\n' which differs from >>> quopri.a2b_qp = None >>> quopri.b2a_qp = None >>> quopri.decodestring("hello \t\r\n") 'hello\n And what's the deal with: >>> import quopri >>> quopri.encodestring("hello \t\r") 'hello \t\r' >>> "hello \t\r".encode("quopri") 'hello=20=09\r' ---------- components: Tests files: test_quopri.diff keywords: patch messages: 175593 nosy: aleperalta priority: normal severity: normal status: open title: Minor difference in decoding quoted-printable text versions: Python 3.3 Added file: http://bugs.python.org/file27985/test_quopri.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16473> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com