@@ -24,7 +24,7 @@ def matchHost(host, regex):
24
24
25
25
26
26
class Arguments :
27
- def __init__ (self , path , args , types , src , data ):
27
+ def __init__ (self , path , args , types = None , src = None , data = None ):
28
28
self .path = path
29
29
self .args = args
30
30
self .types = types
@@ -178,6 +178,19 @@ def testMethodAfterFree(self):
178
178
with self .assertRaises (RuntimeError ):
179
179
self .server .recv ()
180
180
181
+ def testCallbackVarargs (self ):
182
+ def foo (path , args , * varargs ):
183
+ self .cb = Arguments (path , args )
184
+ self .cb_varargs = varargs
185
+ self .server .add_method ('/foo' , 'f' , foo , user_data = 'spam' )
186
+ self .server .send (1234 , '/foo' , 123.456 )
187
+ self .assertTrue (self .server .recv ())
188
+ self .assertEqual (self .cb .path , '/foo' )
189
+ self .assertAlmostEqual (self .cb .args [0 ], 123.456 , places = 3 )
190
+ self .assertEqual (self .cb_varargs [0 ], 'f' )
191
+ self .assertIsInstance (self .cb_varargs [1 ], liblo .Address )
192
+ self .assertEqual (self .cb_varargs [2 ], 'spam' )
193
+
181
194
def testBundleCallbacksFire (self ):
182
195
def bundle_start_cb (timestamp , user_data ):
183
196
self .assertIsInstance (timestamp , float )
0 commit comments