[Python-checkins] r83095 - python/branches/py3k/Lib/test/test_threading.py

brett.cannon python-checkins at python.org
Fri Jul 23 17:50:52 CEST 2010


Author: brett.cannon
Date: Fri Jul 23 17:50:52 2010
New Revision: 83095

Log:
Add more tests for the threading.Thread.repr.

Partially closes issue 9346. Thanks to Brian Brazil for the patch.


Modified:
   python/branches/py3k/Lib/test/test_threading.py

Modified: python/branches/py3k/Lib/test/test_threading.py
==============================================================================
--- python/branches/py3k/Lib/test/test_threading.py	(original)
+++ python/branches/py3k/Lib/test/test_threading.py	Fri Jul 23 17:50:52 2010
@@ -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):
 


More information about the Python-checkins mailing list