def test_connect_with_keywords(self): test = NotifyTestObject() signal = Signal() signal.connect_safe(test.simple_keywords_handler, a=1) signal.connect_safe(test.simple_keywords_handler, a=2, b=3) signal.emit() signal.emit(b=42) signal.emit('ham') test.assert_results( {'a': 1}, { 'a': 2, 'b': 3 }, # Note that emission keyword arguments must override # connection-time keyword arguments. { 'a': 1, 'b': 42 }, { 'a': 2, 'b': 42 }, ('ham', { 'a': 1 }), ('ham', { 'a': 2, 'b': 3 }))
def test_connect_safe (self): test = NotifyTestObject () signal = Signal () signal.connect_safe (test.simple_handler) signal.connect_safe (test.simple_handler) signal.emit () self.assert_ (signal.has_handlers ()) self.assert_ (signal) test.assert_results (())
def test_connect_safe(self): test = NotifyTestObject() signal = Signal() signal.connect_safe(test.simple_handler) signal.connect_safe(test.simple_handler) signal.emit() self.assert_(signal.has_handlers()) self.assert_(signal) test.assert_results(())
def test_connect_with_arguments (self): test = NotifyTestObject () signal = Signal () signal.connect_safe (test.simple_handler, 'one argument') signal.connect_safe (test.simple_handler, 'first', 'second', 3) signal.emit () signal.emit ('a', 'b') test.assert_results ('one argument', ('first', 'second', 3), ('one argument', 'a', 'b'), ('first', 'second', 3, 'a', 'b'))
def test_connect_with_arguments(self): test = NotifyTestObject() signal = Signal() signal.connect_safe(test.simple_handler, 'one argument') signal.connect_safe(test.simple_handler, 'first', 'second', 3) signal.emit() signal.emit('a', 'b') test.assert_results('one argument', ('first', 'second', 3), ('one argument', 'a', 'b'), ('first', 'second', 3, 'a', 'b'))
def test_connect_with_keywords (self): test = NotifyTestObject () signal = Signal () signal.connect_safe (test.simple_keywords_handler, a = 1) signal.connect_safe (test.simple_keywords_handler, a = 2, b = 3) signal.emit () signal.emit (b = 42) signal.emit ('ham') test.assert_results ({ 'a': 1 }, { 'a': 2, 'b' : 3 }, # Note that emission keyword arguments must override # connection-time keyword arguments. { 'a': 1, 'b': 42 }, { 'a': 2, 'b' : 42 }, ('ham', { 'a': 1 }), ('ham', { 'a': 2, 'b' : 3 }))