mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
asyncio: Replace "unittest.mock" with "mock" in unit tests
Use "from unittest import mock". It should simplify my work to merge new tests in Trollius, because Trollius uses "mock" backport for Python 2.
This commit is contained in:
parent
71ec82a501
commit
24ba203504
12 changed files with 368 additions and 368 deletions
|
@ -1,7 +1,7 @@
|
|||
"""Tests for transports.py."""
|
||||
|
||||
import unittest
|
||||
import unittest.mock
|
||||
from unittest import mock
|
||||
|
||||
import asyncio
|
||||
from asyncio import transports
|
||||
|
@ -23,7 +23,7 @@ class TransportTests(unittest.TestCase):
|
|||
|
||||
def test_writelines(self):
|
||||
transport = asyncio.Transport()
|
||||
transport.write = unittest.mock.Mock()
|
||||
transport.write = mock.Mock()
|
||||
|
||||
transport.writelines([b'line1',
|
||||
bytearray(b'line2'),
|
||||
|
@ -70,7 +70,7 @@ class TransportTests(unittest.TestCase):
|
|||
return 512
|
||||
|
||||
transport = MyTransport()
|
||||
transport._protocol = unittest.mock.Mock()
|
||||
transport._protocol = mock.Mock()
|
||||
|
||||
self.assertFalse(transport._protocol_paused)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue