示例#1
0
def test_lzwdecode_garbage():
    # Sometimes, there's garbage at the end of the data like space characters and newline. If a code
    # can't be found in the table, don't raise an Index error, but just return what has been decoded
    # yet.
    eq_(lzw.lzwdecode(b'\x80\x0b\x60\x50\x22\x0c\x0c\x85\x01\xff\xff'),
        b'\x2d\x2d\x2d\x2d\x2d\x41\x2d\x2d\x2d\x42')
示例#2
0
def test_lzwdecode_invalid():
    # Sometimes, the data is simply invalid, which leads us to try to read the character table when
    # there's none. Just return nothing.
    eq_(lzw.lzwdecode(b'\x80\x80\r\n'), b'')
示例#3
0
 def test_lzwdecode(self):
     assert_equal(lzwdecode(b'\x80\x0b\x60\x50\x22\x0c\x0c\x85\x01'),
                  b'\x2d\x2d\x2d\x2d\x2d\x41\x2d\x2d\x2d\x42')
示例#4
0
def test_lzwdecode():
    eq_(lzw.lzwdecode(b'\x80\x0b\x60\x50\x22\x0c\x0c\x85\x01'),
        b'\x2d\x2d\x2d\x2d\x2d\x41\x2d\x2d\x2d\x42')
示例#5
0
def test_lzwdecode_invalid():
    # Sometimes, the data is simply invalid, which leads us to try to read the character table when
    # there's none. Just return nothing.
    eq_(lzw.lzwdecode(b'\x80\x80\r\n'), b'')
示例#6
0
def test_lzwdecode_garbage():
    # Sometimes, there's garbage at the end of the data like space characters and newline. If a code
    # can't be found in the table, don't raise an Index error, but just return what has been decoded
    # yet.
    eq_(lzw.lzwdecode(b'\x80\x0b\x60\x50\x22\x0c\x0c\x85\x01\xff\xff'), b'\x2d\x2d\x2d\x2d\x2d\x41\x2d\x2d\x2d\x42')
示例#7
0
def test_lzwdecode():
    eq_(lzw.lzwdecode(b'\x80\x0b\x60\x50\x22\x0c\x0c\x85\x01'), b'\x2d\x2d\x2d\x2d\x2d\x41\x2d\x2d\x2d\x42')
示例#8
0
 def test_lzwdecode_corrupt(self):
     """Test lzwdecode gracefully ignores corrupt data"""
     self.assertEqual(self.decoded, lzwdecode('\x80\x0b\x60\x50\x22\x0c\x0c\x85\x01\xff\xff'))
     self.assertEqual('', lzwdecode('\x80\x80\r\n'))
示例#9
0
 def test_lzwdecode(self):
     """Test LZW decoder"""
     self.assertEqual(self.decoded, lzwdecode('\x80\x0b\x60\x50\x22\x0c\x0c\x85\x01'))