Commit 3f5f226b authored by Brett Cannon's avatar Brett Cannon

Add more tests for the threading.Thread.repr.

Partially closes issue 9346. Thanks to Brian Brazil for the patch.
parent 148724d3
......@@ -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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment