summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_locks.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-02-26 09:25:02 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-02-26 09:25:02 (GMT)
commit24ba2035048566df2e0876fb719749d984234bc7 (patch)
treed7e3aea3b21b945a2f475247384878ca7723a415 /Lib/test/test_asyncio/test_locks.py
parent71ec82a501d95c43aa6c3559e8dbd05aad23eb50 (diff)
downloadcpython-24ba2035048566df2e0876fb719749d984234bc7.zip
cpython-24ba2035048566df2e0876fb719749d984234bc7.tar.gz
cpython-24ba2035048566df2e0876fb719749d984234bc7.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_asyncio/test_locks.py')
-rw-r--r--Lib/test/test_asyncio/test_locks.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/test/test_asyncio/test_locks.py b/Lib/test/test_asyncio/test_locks.py
index 0975f49..f542463 100644
--- a/Lib/test/test_asyncio/test_locks.py
+++ b/Lib/test/test_asyncio/test_locks.py
@@ -1,7 +1,7 @@
"""Tests for lock.py"""
import unittest
-import unittest.mock
+from unittest import mock
import re
import asyncio
@@ -27,7 +27,7 @@ class LockTests(unittest.TestCase):
self.loop.close()
def test_ctor_loop(self):
- loop = unittest.mock.Mock()
+ loop = mock.Mock()
lock = asyncio.Lock(loop=loop)
self.assertIs(lock._loop, loop)
@@ -250,7 +250,7 @@ class EventTests(unittest.TestCase):
self.loop.close()
def test_ctor_loop(self):
- loop = unittest.mock.Mock()
+ loop = mock.Mock()
ev = asyncio.Event(loop=loop)
self.assertIs(ev._loop, loop)
@@ -275,7 +275,7 @@ class EventTests(unittest.TestCase):
self.assertTrue(repr(ev).endswith('[set]>'))
self.assertTrue(RGX_REPR.match(repr(ev)))
- ev._waiters.append(unittest.mock.Mock())
+ ev._waiters.append(mock.Mock())
self.assertTrue('waiters:1' in repr(ev))
self.assertTrue(RGX_REPR.match(repr(ev)))
@@ -386,7 +386,7 @@ class ConditionTests(unittest.TestCase):
self.loop.close()
def test_ctor_loop(self):
- loop = unittest.mock.Mock()
+ loop = mock.Mock()
cond = asyncio.Condition(loop=loop)
self.assertIs(cond._loop, loop)
@@ -644,11 +644,11 @@ class ConditionTests(unittest.TestCase):
self.loop.run_until_complete(cond.acquire())
self.assertTrue('locked' in repr(cond))
- cond._waiters.append(unittest.mock.Mock())
+ cond._waiters.append(mock.Mock())
self.assertTrue('waiters:1' in repr(cond))
self.assertTrue(RGX_REPR.match(repr(cond)))
- cond._waiters.append(unittest.mock.Mock())
+ cond._waiters.append(mock.Mock())
self.assertTrue('waiters:2' in repr(cond))
self.assertTrue(RGX_REPR.match(repr(cond)))
@@ -688,7 +688,7 @@ class SemaphoreTests(unittest.TestCase):
self.loop.close()
def test_ctor_loop(self):
- loop = unittest.mock.Mock()
+ loop = mock.Mock()
sem = asyncio.Semaphore(loop=loop)
self.assertIs(sem._loop, loop)
@@ -717,11 +717,11 @@ class SemaphoreTests(unittest.TestCase):
self.assertTrue('waiters' not in repr(sem))
self.assertTrue(RGX_REPR.match(repr(sem)))
- sem._waiters.append(unittest.mock.Mock())
+ sem._waiters.append(mock.Mock())
self.assertTrue('waiters:1' in repr(sem))
self.assertTrue(RGX_REPR.match(repr(sem)))
- sem._waiters.append(unittest.mock.Mock())
+ sem._waiters.append(mock.Mock())
self.assertTrue('waiters:2' in repr(sem))
self.assertTrue(RGX_REPR.match(repr(sem)))