Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Prev Previous commit
Next Next commit
Improved tests
  • Loading branch information
Xiaokang2022 committed Oct 19, 2024
commit adfc70b9aa3f84c0f4328d6801d81f53ca319ef5
Empty file.
11 changes: 7 additions & 4 deletions Lib/test/test_inspect/test_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@

from test.test_inspect import inspect_fodder as mod
from test.test_inspect import inspect_fodder2 as mod2
from test.test_inspect import inspect_simple_pkg as pkg
from test.test_inspect import inspect_stringized_annotations
from test.test_inspect import inspect_deferred_annotations

Expand Down Expand Up @@ -123,8 +122,9 @@ def istest(self, predicate, exp):
other == inspect.isfunction:
continue
if predicate == inspect.ispackage and other == inspect.ismodule:
Comment thread
Xiaokang2022 marked this conversation as resolved.
continue
self.assertFalse(other(obj), 'not %s(%s)' % (other.__name__, exp))
self.assertTrue(predicate(obj), '%s(%s)' % (predicate.__name__, exp))
else:
self.assertFalse(other(obj), 'not %s(%s)' % (other.__name__, exp))

def test__all__(self):
support.check__all__(self, inspect, not_exported=("modulesbyfile",), extra=("get_annotations",))
Expand Down Expand Up @@ -179,7 +179,10 @@ def test_excluding_predicates(self):
self.istest(inspect.ismethod, 'git.argue')
self.istest(inspect.ismethod, 'mod.custom_method')
self.istest(inspect.ismodule, 'mod')
self.istest(inspect.ispackage, 'pkg')
self.istest(inspect.ispackage, 'asyncio')
self.istest(inspect.ispackage, 'importlib')
self.assertFalse(inspect.ispackage(mod))
Comment thread
Xiaokang2022 marked this conversation as resolved.
Outdated
self.assertFalse(inspect.ispackage(':)'))
self.istest(inspect.ismethoddescriptor, 'int.__add__')
self.istest(inspect.isdatadescriptor, 'collections.defaultdict.default_factory')
self.istest(inspect.isgenerator, '(x for x in range(2))')
Expand Down
1 change: 0 additions & 1 deletion Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -2498,7 +2498,6 @@ TESTSUBDIRS= idlelib/idle_test \
test/test_importlib/resources \
test/test_importlib/source \
test/test_inspect \
test/test_inspect/inspect_simple_pkg \
test/test_interpreters \
test/test_json \
test/test_module \
Expand Down