Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions Lib/test/test_inspect/test_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -6359,15 +6359,10 @@ def test_thread_module_has_signatures(self):
self._test_module_has_signatures(_thread, no_signature)

def test_time_module_has_signatures(self):
no_signature = {
'asctime', 'ctime', 'get_clock_info', 'gmtime', 'localtime',
'strftime', 'strptime'
}
no_signature |= {name for name in
['clock_getres', 'clock_settime', 'clock_settime_ns',
'pthread_getcpuclockid']
if hasattr(time, name)}
self._test_module_has_signatures(time, no_signature)
no_signature = {'strftime', 'strptime'}
unsupported_signature = {'asctime'}
self._test_module_has_signatures(time, no_signature,
unsupported_signature)

def test_tokenize_module_has_signatures(self):
import tokenize
Expand Down
9 changes: 6 additions & 3 deletions Lib/test/test_unittest/testmock/testhelpers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import inspect
import time
import types
import unittest

from test.support import import_helper

from unittest.mock import (
call, _Call, create_autospec, MagicMock,
Mock, ANY, _CallList, patch, PropertyMock, _callable
Expand Down Expand Up @@ -929,8 +930,10 @@ def check_data_descriptor(mock_attr):


def test_autospec_on_bound_builtin_function(self):
meth = types.MethodType(time.ctime, time.time())
self.assertIsInstance(meth(), str)
_testcapi = import_helper.import_module('_testcapi')
# This function is defined without a signature.
meth = types.MethodType(_testcapi.docstring_no_signature, object())
self.assertIsNone(meth())
mocked = create_autospec(meth)

# no signature, so no spec to check against
Expand Down
Loading
Loading