aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio/test_futures.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2021-12-20 12:23:05 +0200
committerGitHub <noreply@github.com>2021-12-20 12:23:05 +0200
commit6ca78affc8023bc5023189d64d8050857662042a (patch)
treee6cae1875586d1c722005311492b4126707d9a2e /Lib/test/test_asyncio/test_futures.py
parent7c5c3f7254d78babcaf7a2ec187fd6ec53b8403c (diff)
downloadcpython-6ca78affc8023bc5023189d64d8050857662042a.tar.gz
cpython-6ca78affc8023bc5023189d64d8050857662042a.zip
bpo-23819: Get rid of assert statements in test_asyncio (GH-30212)
To keep checks even if run tests with optimized Python. Either use special assertion methods like assertEqual() or raise an AssertionError explicitly.
Diffstat (limited to 'Lib/test/test_asyncio/test_futures.py')
-rw-r--r--Lib/test/test_asyncio/test_futures.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py
index 42b9499edd7..0c379e0fb0f 100644
--- a/Lib/test/test_asyncio/test_futures.py
+++ b/Lib/test/test_asyncio/test_futures.py
@@ -54,30 +54,30 @@ class DuckFuture:
or self.__exception is not None)
def result(self):
- assert not self.cancelled()
+ self.assertFalse(self.cancelled())
if self.__exception is not None:
raise self.__exception
return self.__result
def exception(self):
- assert not self.cancelled()
+ self.assertFalse(self.cancelled())
return self.__exception
def set_result(self, result):
- assert not self.done()
- assert result is not None
+ self.assertFalse(self.done())
+ self.assertIsNotNone(result)
self.__result = result
def set_exception(self, exception):
- assert not self.done()
- assert exception is not None
+ self.assertFalse(self.done())
+ self.assertIsNotNone(exception)
self.__exception = exception
def __iter__(self):
if not self.done():
self._asyncio_future_blocking = True
yield self
- assert self.done()
+ self.assertTrue(self.done())
return self.result()
@@ -91,12 +91,12 @@ class DuckTests(test_utils.TestCase):
def test_wrap_future(self):
f = DuckFuture()
g = asyncio.wrap_future(f)
- assert g is f
+ self.assertIs(g, f)
def test_ensure_future(self):
f = DuckFuture()
g = asyncio.ensure_future(f)
- assert g is f
+ self.assertIs(g, f)
class BaseFutureTests: