diff options
author | Chris Withers <chris@withers.org> | 2020-01-27 14:11:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-27 14:11:19 +0000 |
commit | c7dd3c7d87d6961756d99b57aa13db7c7a03e1f8 (patch) | |
tree | 9138a9b9d594032e15819f1068e4c828f099b3cb /Lib/unittest/test/testmock/testmagicmethods.py | |
parent | 997443c14cc29e5616b9f3d7c337e89fda60de11 (diff) | |
download | cpython-c7dd3c7d87d6961756d99b57aa13db7c7a03e1f8.tar.gz cpython-c7dd3c7d87d6961756d99b57aa13db7c7a03e1f8.zip |
Use relative imports in mock and its tests to help backporting (GH-18197)
* asyncio.run only available in 3.8+
* iscoroutinefunction has important bungfixes in 3.8
* IsolatedAsyncioTestCase only available in 3.8+
Diffstat (limited to 'Lib/unittest/test/testmock/testmagicmethods.py')
-rw-r--r-- | Lib/unittest/test/testmock/testmagicmethods.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/unittest/test/testmock/testmagicmethods.py b/Lib/unittest/test/testmock/testmagicmethods.py index 76b3a560de0..5690f7a6bbb 100644 --- a/Lib/unittest/test/testmock/testmagicmethods.py +++ b/Lib/unittest/test/testmock/testmagicmethods.py @@ -1,8 +1,8 @@ -import asyncio import math import unittest import os import sys +from asyncio import iscoroutinefunction from unittest.mock import AsyncMock, Mock, MagicMock, _magics @@ -286,8 +286,8 @@ class TestMockingMagicMethods(unittest.TestCase): self.assertEqual(math.trunc(mock), mock.__trunc__()) self.assertEqual(math.floor(mock), mock.__floor__()) self.assertEqual(math.ceil(mock), mock.__ceil__()) - self.assertTrue(asyncio.iscoroutinefunction(mock.__aexit__)) - self.assertTrue(asyncio.iscoroutinefunction(mock.__aenter__)) + self.assertTrue(iscoroutinefunction(mock.__aexit__)) + self.assertTrue(iscoroutinefunction(mock.__aenter__)) self.assertIsInstance(mock.__aenter__, AsyncMock) self.assertIsInstance(mock.__aexit__, AsyncMock) @@ -312,8 +312,8 @@ class TestMockingMagicMethods(unittest.TestCase): self.assertEqual(math.trunc(mock), mock.__trunc__()) self.assertEqual(math.floor(mock), mock.__floor__()) self.assertEqual(math.ceil(mock), mock.__ceil__()) - self.assertTrue(asyncio.iscoroutinefunction(mock.__aexit__)) - self.assertTrue(asyncio.iscoroutinefunction(mock.__aenter__)) + self.assertTrue(iscoroutinefunction(mock.__aexit__)) + self.assertTrue(iscoroutinefunction(mock.__aenter__)) self.assertIsInstance(mock.__aenter__, AsyncMock) self.assertIsInstance(mock.__aexit__, AsyncMock) |