summaryrefslogtreecommitdiffstats
path: root/Lib/test/lock_tests.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2014-05-26 01:22:35 (GMT)
committerRaymond Hettinger <python@rcn.com>2014-05-26 01:22:35 (GMT)
commit62f4dad81607d8d0a70223ef3feacdfd3aa5e898 (patch)
tree5e4c3b7ccb6ab56240b77da3946c4e0a301c72f3 /Lib/test/lock_tests.py
parentfa4ed0c145f2e17ccd59c2180cbf7be07c8c872d (diff)
downloadcpython-62f4dad81607d8d0a70223ef3feacdfd3aa5e898.zip
cpython-62f4dad81607d8d0a70223ef3feacdfd3aa5e898.tar.gz
cpython-62f4dad81607d8d0a70223ef3feacdfd3aa5e898.tar.bz2
Issue 21137: Better repr for threading.Lock()
Diffstat (limited to 'Lib/test/lock_tests.py')
-rw-r--r--Lib/test/lock_tests.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py
index 1cbcea2..136f1c3 100644
--- a/Lib/test/lock_tests.py
+++ b/Lib/test/lock_tests.py
@@ -82,7 +82,13 @@ class BaseLockTests(BaseTestCase):
def test_repr(self):
lock = self.locktype()
- repr(lock)
+ self.assertRegex(repr(lock), "<unlocked .* object (.*)?at .*>")
+ del lock
+
+ def test_locked_repr(self):
+ lock = self.locktype()
+ lock.acquire()
+ self.assertRegex(repr(lock), "<locked .* object (.*)?at .*>")
del lock
def test_acquire_destroy(self):