[Telepathy-commits] [telepathy-gabble/master] Nicer code as per dafs comments

Sjoerd Simons sjoerd.simons at collabora.co.uk
Tue Aug 19 10:54:13 PDT 2008


20080730141646-b58c9-9d56abc927f579b531136bbc9facc50bcdbbbe48.gz
---
 tests/twisted/test-caps-hash.py              |    2 +-
 tests/twisted/test-set-status-idempotence.py |   12 +++++-------
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/tests/twisted/test-caps-hash.py b/tests/twisted/test-caps-hash.py
index 2fbd103..17280f4 100644
--- a/tests/twisted/test-caps-hash.py
+++ b/tests/twisted/test-caps-hash.py
@@ -70,7 +70,7 @@ def test_hash(q, bus, conn, stream, contact, contact_handle, client):
     presence = make_presence(contact, None, 'hello')
     stream.send(presence)
 
-    event = q.expect_many(
+    q.expect_many(
         EventPattern('dbus-signal', signal='PresenceUpdate',
             args=[{contact_handle:
                 (0L, {u'available': {'message': 'hello'}})}]),
diff --git a/tests/twisted/test-set-status-idempotence.py b/tests/twisted/test-set-status-idempotence.py
index ab1586f..7e0c024 100644
--- a/tests/twisted/test-set-status-idempotence.py
+++ b/tests/twisted/test-set-status-idempotence.py
@@ -16,14 +16,13 @@ def test_presence(q, bus, conn, stream):
     iface = dbus.Interface (conn,
         u'org.freedesktop.Telepathy.Connection.Interface.Presence')
 
-    def set_presence (status, message):
-        if message != "":
+    def set_presence (status, message = None):
+        if message:
           iface.SetStatus({status: {'message': message}})
         else:
           iface.SetStatus({status: {}})
 
-    run_test(q, bus, conn, stream,
-      (lambda status, message: set_presence(status, message)))
+    run_test(q, bus, conn, stream, set_presence)
 
 def test_simple_presence(q, bus, conn, stream):
     conn.Connect()
@@ -33,7 +32,7 @@ def test_simple_presence(q, bus, conn, stream):
     iface = dbus.Interface (conn,
         u'org.freedesktop.Telepathy.Connection.Interface.SimplePresence')
     run_test(q, bus, conn, stream,
-      (lambda status, message: iface.SetPresence (status, message)))
+      (lambda status, message = "": iface.SetPresence (status, message)))
 
 def run_test(q, bus, conn, stream, set_status_func):
     # Set presence to away. This should cause PresenceUpdate to be emitted,
@@ -74,7 +73,7 @@ def run_test(q, bus, conn, stream, set_status_func):
 
     # call SetPresence with no optional arguments, as this used to cause a
     # crash in tp-glib
-    set_status_func('available', "")
+    set_status_func('available')
 
     signal, simple_signal, presence = q.expect_many (
         EventPattern('dbus-signal', signal='PresenceUpdate'),
@@ -90,4 +89,3 @@ if __name__ == '__main__':
     exec_test(test_simple_presence)
     exec_test(test_presence)
 
-
-- 
1.5.6.3




More information about the Telepathy-commits mailing list