diff options
author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-06-21 21:36:48 (GMT) |
---|---|---|
committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-06-21 21:36:48 (GMT) |
commit | a425c3d5a264c556d31bdd88097c79246b533ea3 (patch) | |
tree | 2ee651277af2bb8d61ad824001aa2bbcbba54585 /Lib/test | |
parent | 01317d2ed5b06310ab9cefa7eed5912819ea89c9 (diff) | |
download | cpython-a425c3d5a264c556d31bdd88097c79246b533ea3.zip cpython-a425c3d5a264c556d31bdd88097c79246b533ea3.tar.gz cpython-a425c3d5a264c556d31bdd88097c79246b533ea3.tar.bz2 |
Make lzma.{encode,decode}_filter_properties private.
These functions were originally added to support LZMA compression in the zipfile
module, and are not of interest for the majority of users.
They can be made public in 3.4 if there is user interest, but in the meanwhile,
I've opted to present a smaller, simpler API for the module's initial release.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_lzma.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Lib/test/test_lzma.py b/Lib/test/test_lzma.py index a086586..a13cf3b 100644 --- a/Lib/test/test_lzma.py +++ b/Lib/test/test_lzma.py @@ -1073,19 +1073,19 @@ class MiscellaneousTestCase(unittest.TestCase): # This value should not be a valid check ID. self.assertFalse(lzma.is_check_supported(lzma.CHECK_UNKNOWN)) - def test_encode_filter_properties(self): + def test__encode_filter_properties(self): with self.assertRaises(TypeError): - lzma.encode_filter_properties(b"not a dict") + lzma._encode_filter_properties(b"not a dict") with self.assertRaises(ValueError): - lzma.encode_filter_properties({"id": 0x100}) + lzma._encode_filter_properties({"id": 0x100}) with self.assertRaises(ValueError): - lzma.encode_filter_properties({"id": lzma.FILTER_LZMA2, "junk": 12}) + lzma._encode_filter_properties({"id": lzma.FILTER_LZMA2, "junk": 12}) with self.assertRaises(lzma.LZMAError): - lzma.encode_filter_properties({"id": lzma.FILTER_DELTA, + lzma._encode_filter_properties({"id": lzma.FILTER_DELTA, "dist": 9001}) # Test with parameters used by zipfile module. - props = lzma.encode_filter_properties({ + props = lzma._encode_filter_properties({ "id": lzma.FILTER_LZMA1, "pb": 2, "lp": 0, @@ -1094,14 +1094,14 @@ class MiscellaneousTestCase(unittest.TestCase): }) self.assertEqual(props, b"]\x00\x00\x80\x00") - def test_decode_filter_properties(self): + def test__decode_filter_properties(self): with self.assertRaises(TypeError): - lzma.decode_filter_properties(lzma.FILTER_X86, {"should be": bytes}) + lzma._decode_filter_properties(lzma.FILTER_X86, {"should be": bytes}) with self.assertRaises(lzma.LZMAError): - lzma.decode_filter_properties(lzma.FILTER_DELTA, b"too long") + lzma._decode_filter_properties(lzma.FILTER_DELTA, b"too long") # Test with parameters used by zipfile module. - filterspec = lzma.decode_filter_properties( + filterspec = lzma._decode_filter_properties( lzma.FILTER_LZMA1, b"]\x00\x00\x80\x00") self.assertEqual(filterspec["id"], lzma.FILTER_LZMA1) self.assertEqual(filterspec["pb"], 2) @@ -1110,10 +1110,10 @@ class MiscellaneousTestCase(unittest.TestCase): self.assertEqual(filterspec["dict_size"], 8 << 20) def test_filter_properties_roundtrip(self): - spec1 = lzma.decode_filter_properties( + spec1 = lzma._decode_filter_properties( lzma.FILTER_LZMA1, b"]\x00\x00\x80\x00") - reencoded = lzma.encode_filter_properties(spec1) - spec2 = lzma.decode_filter_properties(lzma.FILTER_LZMA1, reencoded) + reencoded = lzma._encode_filter_properties(spec1) + spec2 = lzma._decode_filter_properties(lzma.FILTER_LZMA1, reencoded) self.assertEqual(spec1, spec2) |