Author: rhs
Date: Wed May 30 15:12:19 2007
New Revision: 542957
URL: http://svn.apache.org/viewvc?view=rev&rev=542957
Log:
tests moved to test directory
Modified:
incubator/qpid/trunk/qpid/python/qpid/codec.py
Modified: incubator/qpid/trunk/qpid/python/qpid/codec.py
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/qpid/codec.py?view=diff&rev=542957&r1=542956&r2=542957
==============================================================================
--- incubator/qpid/trunk/qpid/python/qpid/codec.py (original)
+++ incubator/qpid/trunk/qpid/python/qpid/codec.py Wed May 30 15:12:19 2007
@@ -214,41 +214,3 @@
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)