mirror of
https://github.com/samba-team/samba.git
synced 2025-08-04 08:22:08 +03:00
test_pack_extra: The old code does not complain when there are too
many data values for the format. Test that the new code behaves the same way.
This commit is contained in:
@ -119,7 +119,21 @@ class PackTests(unittest.TestCase):
|
|||||||
out, rest = unpacker(format, packed + 'hello sailor!')
|
out, rest = unpacker(format, packed + 'hello sailor!')
|
||||||
self.assertEquals(rest, 'hello sailor!')
|
self.assertEquals(rest, 'hello sailor!')
|
||||||
self.assertEquals(list(values), list(out))
|
self.assertEquals(list(values), list(out))
|
||||||
|
|
||||||
|
|
||||||
|
def test_pack_extra(self):
|
||||||
|
"""Leftover values when packing"""
|
||||||
|
cases = [
|
||||||
|
('d', [10, 20]),
|
||||||
|
]
|
||||||
|
for unpacker in both_unpackers:
|
||||||
|
for packer in both_packers:
|
||||||
|
for format, values in cases:
|
||||||
|
bin = packer(format, values)
|
||||||
|
out, rest = unpacker(format, bin)
|
||||||
|
self.assertEquals(list(out), list(values))
|
||||||
|
self.assertEquals(rest, '')
|
||||||
|
|
||||||
|
|
||||||
def test_unpack(self):
|
def test_unpack(self):
|
||||||
"""Cookbook of tricky unpack tests"""
|
"""Cookbook of tricky unpack tests"""
|
||||||
|
Reference in New Issue
Block a user