summaryrefslogtreecommitdiff
path: root/Lib/test/test_threading.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2010-07-23 15:50:52 +0000
committerBrett Cannon <bcannon@gmail.com>2010-07-23 15:50:52 +0000
commit404d5fdc207ecbf0e9ef00350053ee671f1907d4 (patch)
tree4d24cdf00b67d450a2192080c4173980b759135c /Lib/test/test_threading.py
parent39adaff53331cc74972b9688ff3e5280318d51b7 (diff)
downloadcpython-404d5fdc207ecbf0e9ef00350053ee671f1907d4.tar.gz
Add more tests for the threading.Thread.repr.
Partially closes issue 9346. Thanks to Brian Brazil for the patch.
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r--Lib/test/test_threading.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 5ebc482c44..201bfcb180 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -97,7 +97,8 @@ class ThreadTests(BaseTestCase):
self.assertTrue(not t.is_alive())
self.assertNotEqual(t.ident, 0)
self.assertFalse(t.ident is None)
- self.assertTrue(re.match('<TestThread\(.*, \w+ -?\d+\)>', repr(t)))
+ self.assertTrue(re.match('<TestThread\(.*, stopped -?\d+\)>',
+ repr(t)))
if verbose:
print('all tasks done')
self.assertEqual(numrunning.get(), 0)
@@ -413,6 +414,12 @@ class ThreadTests(BaseTestCase):
e.isSet()
threading.activeCount()
+def test_repr_daemon(self):
+ t = threading.Thread()
+ self.assertFalse('daemon' in repr(t))
+ t.daemon = True
+ self.assertTrue('daemon' in repr(t))
+
class ThreadJoinOnShutdown(BaseTestCase):