Message175593
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' |
|
Date |
User |
Action |
Args |
2012-11-14 21:22:06 | aleperalta | set | recipients:
+ aleperalta |
2012-11-14 21:22:06 | aleperalta | set | messageid: <1352928126.09.0.115783436578.issue16473@psf.upfronthosting.co.za> |
2012-11-14 21:22:05 | aleperalta | link | issue16473 messages |
2012-11-14 21:22:05 | aleperalta | create | |
|