Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_threading.py @ 63167:764ec9bbf013
Add more tests for the threading.Thread.repr.
Partially closes issue 9346. Thanks to Brian Brazil for the patch.
| author | Brett Cannon <bcannon@gmail.com> |
|---|---|
| date | Fri, 23 Jul 2010 15:50:52 +0000 |
| parents | 493bb4585e38 |
| children | 383e8463f56c |
line wrap: on
line diff
--- a/Lib/test/test_threading.py Fri Jul 23 15:50:02 2010 +0000 +++ b/Lib/test/test_threading.py Fri Jul 23 15:50:52 2010 +0000 @@ -97,7 +97,8 @@ 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 @@ 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):
