@@ -0,0 +1,1024 @@
+#!/usr/bin/env python%0A# vim: set sts=4 sw=4 et:%0A%0Aimport unittest%0Aimport rpc%0A%0Aclass _RPCTestClass(rpc.RPCSerializable):%0A    rpc_fields = ('a', 'b')%0A    a = 1%0A    b = '2'%0A%0Aclass _CustomClass(object):%0A    def rpc_encode(self):%0A        return 'hilipati'%0A%0A    @classmethod%0A    def rpc_decode(cls, rpcobj):%0A        return 'joop'%0A%0Aclass TestRPC(unittest.TestCase):%0A%0A   def testSerializeSimple(self):%0A       testobj = _RPCTestClass()%0A       encoded = rpc.rpc_encode(testobj)%0A       self.assertEqual(encoded, %7B'a':1, 'b':'2'%7D)%0A       # change something%0A       encoded%5B'a'%5D = 2%0A       decoded = rpc.rpc_decode(_RPCTestClass, encoded)%0A       self.assert_(isinstance(decoded, _RPCTestClass))%0A       self.assertEqual(decoded.a, 2)%0A        %0A   def testSerializeCustom(self):%0A       testobj = _CustomClass()%0A       encoded = rpc.rpc_encode(testobj)%0A       self.assertEqual(encoded, 'hilipati')%0A       decoded = rpc.rpc_decode(_CustomClass, encoded)%0A       self.assertEqual(decoded, 'joop')%0A%0A%0Aif __name__ == '__main__':%0A    unittest.main()%0A

add unit tests for rpc.py