summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2010-07-23 15:50:52 (GMT)
committerBrett Cannon <bcannon@gmail.com>2010-07-23 15:50:52 (GMT)
commit3f5f226ba0dab128f6a1b7ae534b1c29eb5db0e9 (patch)
treeb7d969fa9074dbb5f23786908b4076de879c6fca
parent148724d39b082d9ea19297262d97984127594f14 (diff)
downloadcpython-3f5f226ba0dab128f6a1b7ae534b1c29eb5db0e9.zip
cpython-3f5f226ba0dab128f6a1b7ae534b1c29eb5db0e9.tar.gz
cpython-3f5f226ba0dab128f6a1b7ae534b1c29eb5db0e9.tar.bz2
Add more tests for the threading.Thread.repr.
Partially closes issue 9346. Thanks to Brian Brazil for the patch.
-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 5ebc482..201bfcb 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):