diff options
author | Raymond Hettinger <python@rcn.com> | 2017-01-16 22:43:43 -0800 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2017-01-16 22:43:43 -0800 |
commit | b838d4d0bfdbd6d564c6ea06a7d4180c05d87b78 (patch) | |
tree | 9e6a3fa3d1432a42335f960d26e63d4aade6a1f4 /Lib/unittest/test/testmock/testpatch.py | |
parent | c6c4e8e2971286b406a7604648a47fe10d2d260b (diff) | |
parent | bd700941838fb538e8c7ab4bbc69e2684568cb45 (diff) | |
download | cpython-b838d4d0bfdbd6d564c6ea06a7d4180c05d87b78.tar.gz |
merge
Diffstat (limited to 'Lib/unittest/test/testmock/testpatch.py')
-rw-r--r-- | Lib/unittest/test/testmock/testpatch.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/unittest/test/testmock/testpatch.py b/Lib/unittest/test/testmock/testpatch.py index dfce3696d6..fe4ecefd44 100644 --- a/Lib/unittest/test/testmock/testpatch.py +++ b/Lib/unittest/test/testmock/testpatch.py @@ -10,9 +10,9 @@ from unittest.test.testmock import support from unittest.test.testmock.support import SomeClass, is_instance from unittest.mock import ( - NonCallableMock, CallableMixin, patch, sentinel, + NonCallableMock, CallableMixin, sentinel, MagicMock, Mock, NonCallableMagicMock, patch, _patch, - DEFAULT, call, _get_target, _patch + DEFAULT, call, _get_target ) @@ -969,8 +969,14 @@ class PatchTest(unittest.TestCase): def test_autospec_function(self): @patch('%s.function' % __name__, autospec=True) def test(mock): + function.assert_not_called() + self.assertRaises(AssertionError, function.assert_called) + self.assertRaises(AssertionError, function.assert_called_once) function(1) + self.assertRaises(AssertionError, function.assert_not_called) function.assert_called_with(1) + function.assert_called() + function.assert_called_once() function(2, 3) function.assert_called_with(2, 3) |