summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test/testmock/testhelpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/unittest/test/testmock/testhelpers.py')
-rw-r--r--Lib/unittest/test/testmock/testhelpers.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/testhelpers.py b/Lib/unittest/test/testmock/testhelpers.py
index d2202a7..7919482 100644
--- a/Lib/unittest/test/testmock/testhelpers.py
+++ b/Lib/unittest/test/testmock/testhelpers.py
@@ -1,3 +1,5 @@
+import time
+import types
import unittest
from unittest.mock import (
@@ -856,6 +858,19 @@ class SpecSignatureTest(unittest.TestCase):
check_data_descriptor(foo.desc)
+ def test_autospec_on_bound_builtin_function(self):
+ meth = types.MethodType(time.ctime, time.time())
+ self.assertIsInstance(meth(), str)
+ mocked = create_autospec(meth)
+
+ # no signature, so no spec to check against
+ mocked()
+ mocked.assert_called_once_with()
+ mocked.reset_mock()
+ mocked(4, 5, 6)
+ mocked.assert_called_once_with(4, 5, 6)
+
+
class TestCallList(unittest.TestCase):
def test_args_list_contains_call_list(self):