FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-127949: fix DeprecationWarning in test_inspect.py by graingert · Pull Request #128215 · python/cpython · GitHub

/ cpython Public
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
28 changes: 13 additions & 15 deletions Lib/test/test_inspect/test_inspect.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from annotationlib import Format, ForwardRef
import asyncio
import builtins
import collections
import copy
Expand Down Expand Up @@ -73,11 +72,6 @@ def revise(filename, *args):
git = mod.StupidGit()


def tearDownModule():
if support.has_socket_support:
asyncio._set_event_loop_policy(None)


def signatures_with_lexicographic_keyword_only_parameters():
"""
Yields a whole bunch of functions with only keyword-only parameters,
Expand Down Expand Up @@ -205,7 +199,7 @@ def test_excluding_predicates(self):
self.assertFalse(inspect.ismethodwrapper(type("AnyClass", (), {})))

def test_ispackage(self):
self.istest(inspect.ispackage, 'asyncio')
self.istest(inspect.ispackage, 'unittest')
self.istest(inspect.ispackage, 'importlib')
self.assertFalse(inspect.ispackage(inspect))
self.assertFalse(inspect.ispackage(mod))
Expand Down Expand Up @@ -1166,16 +1160,20 @@ def f(self):
# This is necessary when the test is run multiple times.
sys.modules.pop("inspect_actual")

@unittest.skipIf(
support.is_emscripten or support.is_wasi,
"socket.accept is broken"
)
def test_nested_class_definition_inside_async_function(self):
import asyncio
self.addCleanup(asyncio.set_event_loop_policy, None)
self.assertSourceEqual(asyncio.run(mod2.func225()), 226, 227)
def run(coro):
try:
coro.send(None)
Comment thread
kumaraditya303 marked this conversation as resolved.
except StopIteration as e:
return e.value
else:
raise RuntimeError("coroutine did not complete synchronously!")
finally:
coro.close()

self.assertSourceEqual(run(mod2.func225()), 226, 227)
self.assertSourceEqual(mod2.cls226, 231, 235)
self.assertSourceEqual(asyncio.run(mod2.cls226().func232()), 233, 234)
self.assertSourceEqual(run(mod2.cls226().func232()), 233, 234)

def test_class_definition_same_name_diff_methods(self):
self.assertSourceEqual(mod2.cls296, 296, 298)
Expand Down

Back | FazBrowse Home | New Git URL