Refine encoding support

- Push decoding down into the LRU cache
- Cope gracefully with corrupted data and incorrect encoding headers
This commit is contained in:
Aldo Cortesi
2011-07-17 10:25:25 +12:00
parent 7ec03e45a5
commit ce41046786
3 changed files with 17 additions and 6 deletions

View File

@@ -18,11 +18,13 @@ class udecode_gzip(libpry.AutoTree):
gf.write('string')
gf.close()
assert 'string' == encoding.decode('gzip', s.getvalue())
assert None == encoding.decode("gzip", "bogus")
class udecode_deflate(libpry.AutoTree):
def test_simple(self):
assert 'string' == encoding.decode('deflate', zlib.compress('string'))
assert 'string' == encoding.decode('deflate', zlib.compress('string')[2:-4])
assert None == encoding.decode("deflate", "bogus")
tests = [
udecode_identity(),