mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
Add more tests for the threading.Thread.repr.
Partially closes issue 9346. Thanks to Brian Brazil for the patch.
This commit is contained in:
parent
148724d39b
commit
3f5f226ba0
1 changed files with 8 additions and 1 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue