Skip to content

Commit ca3e771

Browse files
Use a function which is defined without a signature
Any builtin function can get a signature, therefore the test uses the function which exists for testing the lack of it.
1 parent 4108372 commit ca3e771

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

Lib/test/test_unittest/testmock/testhelpers.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import types
33
import unittest
44

5+
from test.support import import_helper
6+
57
from unittest.mock import (
68
call, _Call, create_autospec, MagicMock,
79
Mock, ANY, _CallList, patch, PropertyMock, _callable
@@ -928,9 +930,10 @@ def check_data_descriptor(mock_attr):
928930

929931

930932
def test_autospec_on_bound_builtin_function(self):
931-
# max() is variadic, therefore it has no signature.
932-
meth = types.MethodType(max, [4, 5, 6])
933-
self.assertEqual(meth(), 6)
933+
_testcapi = import_helper.import_module('_testcapi')
934+
# This function is defined without a signature.
935+
meth = types.MethodType(_testcapi.docstring_no_signature, object())
936+
self.assertIsNone(meth())
934937
mocked = create_autospec(meth)
935938

936939
# no signature, so no spec to check against

0 commit comments

Comments
 (0)