Skip to content

Commit 0d20fc7

Browse files
authored
gh-109505: Remove unnecessary hasattr checks from test_asyncio (#109506)
1 parent b10de68 commit 0d20fc7

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

Lib/test/test_asyncio/test_events.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Tests for events.py."""
22

3-
import collections.abc
43
import concurrent.futures
54
import functools
65
import io
@@ -2335,8 +2334,6 @@ def check_source_traceback(h):
23352334
h = loop.call_later(0, noop)
23362335
check_source_traceback(h)
23372336

2338-
@unittest.skipUnless(hasattr(collections.abc, 'Coroutine'),
2339-
'No collections.abc.Coroutine')
23402337
def test_coroutine_like_object_debug_formatting(self):
23412338
# Test that asyncio can format coroutines that are instances of
23422339
# collections.abc.Coroutine, but lack cr_core or gi_code attributes

Lib/test/test_asyncio/utils.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@
3737

3838

3939
def data_file(*filename):
40-
if hasattr(support, 'TEST_HOME_DIR'):
41-
fullname = os.path.join(support.TEST_HOME_DIR, *filename)
42-
if os.path.isfile(fullname):
43-
return fullname
40+
fullname = os.path.join(support.TEST_HOME_DIR, *filename)
41+
if os.path.isfile(fullname):
42+
return fullname
4443
fullname = os.path.join(os.path.dirname(__file__), '..', *filename)
4544
if os.path.isfile(fullname):
4645
return fullname

0 commit comments

Comments
 (0)