def test_context_manager(self): with xmlrpclib.ServerProxy(URL) as server: server.add(2, 3) self.assertNotEqual(server('transport')._connection, (None, None)) self.assertEqual(server('transport')._connection, (None, None))
def test_context_manager_method_error(self): try: with xmlrpclib.ServerProxy(URL) as server: server.add(2, "a") except xmlrpclib.Fault: pass self.assertEqual(server('transport')._connection, (None, None))
def test_unicode_host(self): server = xmlrpclib.ServerProxy("http://%s:%d/RPC2" % (ADDR, PORT)) self.assertEqual(server.add("a", "\xe9"), "a\xe9")
def test_unicode_host(self): server = xmlrpclib.ServerProxy('http://%s:%d/RPC2' % (ADDR, PORT)) self.assertEqual(server.add('a', 'é'), 'aé')