diff options
author | Martin Pool <mbp@samba.org> | 2002-11-04 20:34:25 +0000 |
---|---|---|
committer | Martin Pool <mbp@samba.org> | 2002-11-04 20:34:25 +0000 |
commit | b700eafad9b3ea1567dba2ffccd28a2bd91e88e5 (patch) | |
tree | 607a5e62e0e2c18b77c5e601a7dba44358489a1c | |
parent | f10a55e3bee1ecf0dc3a5050660e6977bbe67cd9 (diff) | |
download | samba-b700eafad9b3ea1567dba2ffccd28a2bd91e88e5.tar.gz samba-b700eafad9b3ea1567dba2ffccd28a2bd91e88e5.tar.bz2 samba-b700eafad9b3ea1567dba2ffccd28a2bd91e88e5.zip |
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 used to be commit b0143e77d64f6af977395cf39e50f35e46486157)
-rwxr-xr-x | source3/python/examples/tdbpack/test_tdbpack.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source3/python/examples/tdbpack/test_tdbpack.py b/source3/python/examples/tdbpack/test_tdbpack.py index ba0b26342a..a6aecd1833 100755 --- a/source3/python/examples/tdbpack/test_tdbpack.py +++ b/source3/python/examples/tdbpack/test_tdbpack.py @@ -119,7 +119,21 @@ class PackTests(unittest.TestCase): out, rest = unpacker(format, packed + 'hello sailor!') self.assertEquals(rest, 'hello sailor!') 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): """Cookbook of tricky unpack tests""" |