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

Skip to content

Commit b48fe76

Browse files
author
Siddharta Govindaraj
committed
Checking method call parameters
1 parent 333fc5e commit b48fe76

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

stock_alerter/tests/test_event.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,6 @@
44
from ..event import Event
55

66

7-
class Mock:
8-
called = False
9-
params = ()
10-
11-
def __call__(self, *args, **kwargs):
12-
self.called = True
13-
self.params = (args, kwargs)
14-
15-
167
class EventTest(unittest.TestCase):
178
def test_a_listener_is_notified_when_an_event_is_raised(self):
189
listener = mock.Mock()
@@ -22,8 +13,8 @@ def test_a_listener_is_notified_when_an_event_is_raised(self):
2213
self.assertTrue(listener.called)
2314

2415
def test_a_listener_is_passed_right_parameters(self):
25-
listener = Mock()
16+
listener = mock.Mock()
2617
event = Event()
2718
event.connect(listener)
2819
event.fire(5, shape="square")
29-
self.assertEqual(((5, ), {"shape": "square"}), listener.params)
20+
listener.assert_called_with(5, shape="square")

0 commit comments

Comments
 (0)