dbus/python/tests test-client.py,1.3,1.4

Seth Nickell seth at pdx.freedesktop.org
Mon May 31 23:13:33 PDT 2004


Update of /cvs/dbus/dbus/python/tests
In directory pdx:/tmp/cvs-serv16903/python/tests

Modified Files:
	test-client.py 
Log Message:
2004-06-01  Seth Nickell  <seth at gnome.org>

	* python/dbus_bindings.pyx.in:
	* python/tests/test-client.py:

	Round off basic type support. Add dicts (yay!), and 
	remaining array types.

	Make MessageIter more general so it works for dicts too.

	Mark all loop variables as C integers.


Index: test-client.py
===================================================================
RCS file: /cvs/dbus/dbus/python/tests/test-client.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- a/test-client.py	1 Jun 2004 01:20:59 -0000	1.3
+++ b/test-client.py	1 Jun 2004 06:13:31 -0000	1.4
@@ -31,6 +31,21 @@
 
     for i in range(len(sent_list)):
         ensure_same(sent_list[i], reply_list[i])
+
+def TestEchoDict(sent_dict):
+    assert(type(sent_dict) == dict)
+
+    global remote_object
+    
+    reply_dict = remote_object.Echo(sent_dict)
+
+
+    assert(type(reply_dict) == dict)
+
+    assert(len(reply_dict) == len(sent_dict))
+
+    for key in sent_dict.keys():
+        ensure_same(reply_dict[key], sent_dict[key])
     
 session_bus = dbus.SessionBus()
 
@@ -61,3 +76,26 @@
 for i in range(200):
     double_list.append(float(i) / 1000)
 TestEchoList(double_list)
+
+#FIXME: this currently fails!
+#empty_list = []
+#TestEchoList(empty_list)
+
+string_to_int_dict = {}
+for i in range(200):
+    string_to_int_dict["key" + str(i)] = i
+TestEchoDict(string_to_int_dict)
+
+string_to_double_dict = {}
+for i in range(200):
+    string_to_double_dict["key" + str(i)] = float(i) / 1000
+TestEchoDict(string_to_double_dict)
+
+string_to_string_dict = {}
+for i in range(200):
+    string_to_string_dict["key" + str(i)] = "value" + str(i)
+TestEchoDict(string_to_string_dict)
+
+#FIXME: this currently crashes dbus in c code
+#empty_dict = {}
+#TestEchoDict(empty_dict)




More information about the dbus-commit mailing list