Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d916a2e

Browse files
author
Siddharta Govindaraj
committed
Hand written mock - checking parameters
1 parent eac4c29 commit d916a2e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

stock_alerter/tests/test_event.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,14 @@ def listener():
1414
event.connect(listener)
1515
event.fire()
1616
self.assertTrue(called)
17+
18+
def test_a_listener_is_passed_right_parameters(self):
19+
params = ()
20+
def listener(*args, **kwargs):
21+
nonlocal params
22+
params = (args, kwargs)
23+
24+
event = Event()
25+
event.connect(listener)
26+
event.fire(5, shape="square")
27+
self.assertEqual(((5, ), {"shape":"square"}), params)

0 commit comments

Comments
 (0)