summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test/testmock/testhelpers.py
diff options
context:
space:
mode:
authorMichael Foord <michael@voidspace.org.uk>2012-06-09 16:31:59 (GMT)
committerMichael Foord <michael@voidspace.org.uk>2012-06-09 16:31:59 (GMT)
commit75963643b178f9d72d3b6bb02d136d67c9cc6d3e (patch)
treebfb5554802f021c2686f505120312f87bf09574d /Lib/unittest/test/testmock/testhelpers.py
parentafc0c77b421baf8ac2376e563dd9be25e1e1eb63 (diff)
downloadcpython-75963643b178f9d72d3b6bb02d136d67c9cc6d3e.zip
cpython-75963643b178f9d72d3b6bb02d136d67c9cc6d3e.tar.gz
cpython-75963643b178f9d72d3b6bb02d136d67c9cc6d3e.tar.bz2
Fix exception when calling reset_mock on a mock created with autospec
Diffstat (limited to 'Lib/unittest/test/testmock/testhelpers.py')
-rw-r--r--Lib/unittest/test/testmock/testhelpers.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/testhelpers.py b/Lib/unittest/test/testmock/testhelpers.py
index 7a7145e..8bfb293 100644
--- a/Lib/unittest/test/testmock/testhelpers.py
+++ b/Lib/unittest/test/testmock/testhelpers.py
@@ -355,6 +355,13 @@ class SpecSignatureTest(unittest.TestCase):
self.assertEqual(mock(), 'foo')
+ def test_autospec_reset_mock(self):
+ m = create_autospec(int)
+ int(m)
+ m.reset_mock()
+ self.assertEqual(m.__int__.call_count, 0)
+
+
def test_mocking_unbound_methods(self):
class Foo(object):
def foo(self, foo):