diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2011-10-26 13:50:50 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-10-26 13:50:50 (GMT) |
| commit | e46ef289e142982d7bd592faa7b0f85470364c01 (patch) | |
| tree | cda253e03788f7db0a7cdcd05662f66b4455e298 /src/python/stdlib/test/test_xdrlib.py | |
| parent | d0d0d62bbcbb5c3417f8cba419c83bac192ea985 (diff) | |
| download | powder-e46ef289e142982d7bd592faa7b0f85470364c01.zip powder-e46ef289e142982d7bd592faa7b0f85470364c01.tar.gz | |
Remove Python console stuff
Diffstat (limited to 'src/python/stdlib/test/test_xdrlib.py')
| -rw-r--r-- | src/python/stdlib/test/test_xdrlib.py | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/python/stdlib/test/test_xdrlib.py b/src/python/stdlib/test/test_xdrlib.py deleted file mode 100644 index ab6e460..0000000 --- a/src/python/stdlib/test/test_xdrlib.py +++ /dev/null @@ -1,56 +0,0 @@ -from test import test_support -import unittest - -import xdrlib - -class XDRTest(unittest.TestCase): - - def test_xdr(self): - p = xdrlib.Packer() - - s = 'hello world' - a = ['what', 'is', 'hapnin', 'doctor'] - - p.pack_int(42) - p.pack_uint(9) - p.pack_bool(True) - p.pack_bool(False) - p.pack_uhyper(45L) - p.pack_float(1.9) - p.pack_double(1.9) - p.pack_string(s) - p.pack_list(range(5), p.pack_uint) - p.pack_array(a, p.pack_string) - - # now verify - data = p.get_buffer() - up = xdrlib.Unpacker(data) - - self.assertEqual(up.get_position(), 0) - - self.assertEqual(up.unpack_int(), 42) - self.assertEqual(up.unpack_uint(), 9) - self.assertTrue(up.unpack_bool() is True) - - # remember position - pos = up.get_position() - self.assertTrue(up.unpack_bool() is False) - - # rewind and unpack again - up.set_position(pos) - self.assertTrue(up.unpack_bool() is False) - - self.assertEqual(up.unpack_uhyper(), 45L) - self.assertAlmostEqual(up.unpack_float(), 1.9) - self.assertAlmostEqual(up.unpack_double(), 1.9) - self.assertEqual(up.unpack_string(), s) - self.assertEqual(up.unpack_list(up.unpack_uint), range(5)) - self.assertEqual(up.unpack_array(up.unpack_string), a) - up.done() - self.assertRaises(EOFError, up.unpack_uint) - -def test_main(): - test_support.run_unittest(XDRTest) - -if __name__ == "__main__": - test_main() |
