File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -306,6 +306,12 @@ def _setup_func(funcopy, mock):
306306 if not _is_instance_mock (mock ):
307307 return
308308
309+ def assert_called (* args , ** kwargs ):
310+ return mock .assert_called (* args , ** kwargs )
311+ def assert_not_called (* args , ** kwargs ):
312+ return mock .assert_not_called (* args , ** kwargs )
313+ def assert_called_once (* args , ** kwargs ):
314+ return mock .assert_called_once (* args , ** kwargs )
309315 def assert_called_with (* args , ** kwargs ):
310316 return mock .assert_called_with (* args , ** kwargs )
311317 def assert_called_once_with (* args , ** kwargs ):
@@ -338,6 +344,9 @@ def reset_mock():
338344 funcopy .assert_has_calls = assert_has_calls
339345 funcopy .assert_any_call = assert_any_call
340346 funcopy .reset_mock = reset_mock
347+ funcopy .assert_called = assert_called
348+ funcopy .assert_not_called = assert_not_called
349+ funcopy .assert_called_once = assert_called_once
341350
342351 mock ._mock_delegate = funcopy
343352
Original file line number Diff line number Diff line change @@ -974,8 +974,14 @@ def function(mock):
974974 def test_autospec_function (self ):
975975 @patch ('%s.function' % __name__ , autospec = True )
976976 def test (mock ):
977+ function .assert_not_called ()
978+ self .assertRaises (AssertionError , function .assert_called )
979+ self .assertRaises (AssertionError , function .assert_called_once )
977980 function (1 )
981+ self .assertRaises (AssertionError , function .assert_not_called )
978982 function .assert_called_with (1 )
983+ function .assert_called ()
984+ function .assert_called_once ()
979985 function (2 , 3 )
980986 function .assert_called_with (2 , 3 )
981987
You can’t perform that action at this time.
0 commit comments