From ab359d79804a3b87d59294bb4116a4c88a48e531 Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Wed, 30 May 2007 22:12:19 +0000 Subject: tests moved to test directory git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@542957 13f79535-47bb-0310-9956-ffa450edef68 --- python/qpid/codec.py | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'python') diff --git a/python/qpid/codec.py b/python/qpid/codec.py index 3c1e73c2e6..b0b596b89c 100644 --- a/python/qpid/codec.py +++ b/python/qpid/codec.py @@ -214,41 +214,3 @@ class Codec: return self.decode_longstr() else: return ReferenceId(self.decode_longstr()) - -def test(type, value): - if isinstance(value, (list, tuple)): - values = value - else: - values = [value] - stream = StringIO() - codec = Codec(stream) - for v in values: - codec.encode(type, v) - codec.flush() - enc = stream.getvalue() - stream.reset() - dup = [] - for i in xrange(len(values)): - dup.append(codec.decode(type)) - if values != dup: - raise AssertionError("%r --> %r --> %r" % (values, enc, dup)) - -if __name__ == "__main__": - def dotest(type, value): - args = (type, value) - test(*args) - - for value in ("1", "0", "110", "011", "11001", "10101", "10011"): - for i in range(10): - dotest("bit", map(lambda x: x == "1", value*i)) - - for value in ({}, {"asdf": "fdsa", "fdsa": 1, "three": 3}, {"one": 1}): - dotest("table", value) - - for type in ("octet", "short", "long", "longlong"): - for value in range(0, 256): - dotest(type, value) - - for type in ("shortstr", "longstr"): - for value in ("", "a", "asdf"): - dotest(type, value) -- cgit v1.2.1