diff options
author | Gregory P. Smith <greg@krypto.org> | 2016-10-06 21:31:23 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2016-10-06 21:31:23 (GMT) |
commit | ac5084b6c760ff5e6469854373fe6c3c81804f87 (patch) | |
tree | 091838773df00af3922173237691abc99d9e3044 /Lib/unittest/test | |
parent | 0ebdd0776c95a578ac9d25a27a34492144a04a0a (diff) | |
download | cpython-ac5084b6c760ff5e6469854373fe6c3c81804f87.zip cpython-ac5084b6c760ff5e6469854373fe6c3c81804f87.tar.gz cpython-ac5084b6c760ff5e6469854373fe6c3c81804f87.tar.bz2 |
Fixes issue28380: unittest.mock Mock autospec functions now properly support
assert_called, assert_not_called, and assert_called_once.
Diffstat (limited to 'Lib/unittest/test')
-rw-r--r-- | Lib/unittest/test/testmock/testpatch.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/testpatch.py b/Lib/unittest/test/testmock/testpatch.py index 2e0c08f..fe4ecef 100644 --- a/Lib/unittest/test/testmock/testpatch.py +++ b/Lib/unittest/test/testmock/testpatch.py @@ -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) |