From 7265682a4d57d88956cb54f98f7a470465bbf417 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Mon, 18 Aug 2014 00:52:24 +0200 Subject: cleanup semicolons, whitespace and mutable default arguments --- sleekxmpp/test/sleektest.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'sleekxmpp/test') diff --git a/sleekxmpp/test/sleektest.py b/sleekxmpp/test/sleektest.py index d28f77e2..e26f99ce 100644 --- a/sleekxmpp/test/sleektest.py +++ b/sleekxmpp/test/sleektest.py @@ -288,11 +288,8 @@ class SleekTest(unittest.TestCase): if self.xmpp: self.xmpp.socket.disconnect_error() - def stream_start(self, mode='client', skip=True, header=None, - socket='mock', jid='tester@localhost', - password='test', server='localhost', - port=5222, sasl_mech=None, - plugins=None, plugin_config={}): + def stream_start(self, mode='client', skip=True, header=None, socket='mock', jid='tester@localhost', + password='test', server='localhost', port=5222, sasl_mech=None, plugins=None, plugin_config=None): """ Initialize an XMPP client or component using a dummy XML stream. @@ -315,6 +312,9 @@ class SleekTest(unittest.TestCase): plugins -- List of plugins to register. By default, all plugins are loaded. """ + if not plugin_config: + plugin_config = {} + if mode == 'client': self.xmpp = ClientXMPP(jid, password, sasl_mech=sasl_mech, @@ -425,8 +425,7 @@ class SleekTest(unittest.TestCase): parts.append('xmlns="%s"' % default_ns) return header % ' '.join(parts) - def recv(self, data, defaults=[], method='exact', - use_values=True, timeout=1): + def recv(self, data, defaults=None, method='exact', use_values=True, timeout=1): """ Pass data to the dummy XMPP client as if it came from an XMPP server. @@ -447,6 +446,9 @@ class SleekTest(unittest.TestCase): timeout -- Time to wait in seconds for data to be received by a live connection. """ + if not defaults: + defaults = [] + if self.xmpp.socket.is_live: # we are working with a live connection, so we should # verify what has been received instead of simulating -- cgit v1.2.3 From 3dd379cdf12d885e26f8ec26c54879a95d5f0b84 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Mon, 18 Aug 2014 15:15:14 +0200 Subject: Revert "cleanup semicolons, whitespace and mutable default arguments" This reverts commit 7265682a4d57d88956cb54f98f7a470465bbf417. --- sleekxmpp/test/sleektest.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'sleekxmpp/test') diff --git a/sleekxmpp/test/sleektest.py b/sleekxmpp/test/sleektest.py index e26f99ce..d28f77e2 100644 --- a/sleekxmpp/test/sleektest.py +++ b/sleekxmpp/test/sleektest.py @@ -288,8 +288,11 @@ class SleekTest(unittest.TestCase): if self.xmpp: self.xmpp.socket.disconnect_error() - def stream_start(self, mode='client', skip=True, header=None, socket='mock', jid='tester@localhost', - password='test', server='localhost', port=5222, sasl_mech=None, plugins=None, plugin_config=None): + def stream_start(self, mode='client', skip=True, header=None, + socket='mock', jid='tester@localhost', + password='test', server='localhost', + port=5222, sasl_mech=None, + plugins=None, plugin_config={}): """ Initialize an XMPP client or component using a dummy XML stream. @@ -312,9 +315,6 @@ class SleekTest(unittest.TestCase): plugins -- List of plugins to register. By default, all plugins are loaded. """ - if not plugin_config: - plugin_config = {} - if mode == 'client': self.xmpp = ClientXMPP(jid, password, sasl_mech=sasl_mech, @@ -425,7 +425,8 @@ class SleekTest(unittest.TestCase): parts.append('xmlns="%s"' % default_ns) return header % ' '.join(parts) - def recv(self, data, defaults=None, method='exact', use_values=True, timeout=1): + def recv(self, data, defaults=[], method='exact', + use_values=True, timeout=1): """ Pass data to the dummy XMPP client as if it came from an XMPP server. @@ -446,9 +447,6 @@ class SleekTest(unittest.TestCase): timeout -- Time to wait in seconds for data to be received by a live connection. """ - if not defaults: - defaults = [] - if self.xmpp.socket.is_live: # we are working with a live connection, so we should # verify what has been received instead of simulating -- cgit v1.2.3 From afc939708ff71e168f9204f1eab8823b7dc9f875 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Mon, 18 Aug 2014 00:52:24 +0200 Subject: cleanup semicolons, whitespace and mutable default arguments --- sleekxmpp/test/sleektest.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'sleekxmpp/test') diff --git a/sleekxmpp/test/sleektest.py b/sleekxmpp/test/sleektest.py index d28f77e2..e26f99ce 100644 --- a/sleekxmpp/test/sleektest.py +++ b/sleekxmpp/test/sleektest.py @@ -288,11 +288,8 @@ class SleekTest(unittest.TestCase): if self.xmpp: self.xmpp.socket.disconnect_error() - def stream_start(self, mode='client', skip=True, header=None, - socket='mock', jid='tester@localhost', - password='test', server='localhost', - port=5222, sasl_mech=None, - plugins=None, plugin_config={}): + def stream_start(self, mode='client', skip=True, header=None, socket='mock', jid='tester@localhost', + password='test', server='localhost', port=5222, sasl_mech=None, plugins=None, plugin_config=None): """ Initialize an XMPP client or component using a dummy XML stream. @@ -315,6 +312,9 @@ class SleekTest(unittest.TestCase): plugins -- List of plugins to register. By default, all plugins are loaded. """ + if not plugin_config: + plugin_config = {} + if mode == 'client': self.xmpp = ClientXMPP(jid, password, sasl_mech=sasl_mech, @@ -425,8 +425,7 @@ class SleekTest(unittest.TestCase): parts.append('xmlns="%s"' % default_ns) return header % ' '.join(parts) - def recv(self, data, defaults=[], method='exact', - use_values=True, timeout=1): + def recv(self, data, defaults=None, method='exact', use_values=True, timeout=1): """ Pass data to the dummy XMPP client as if it came from an XMPP server. @@ -447,6 +446,9 @@ class SleekTest(unittest.TestCase): timeout -- Time to wait in seconds for data to be received by a live connection. """ + if not defaults: + defaults = [] + if self.xmpp.socket.is_live: # we are working with a live connection, so we should # verify what has been received instead of simulating -- cgit v1.2.3