diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2008-06-01 23:48:47 +0000 |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2008-06-01 23:48:47 +0000 |
commit | 8856ddae2522c644132b5d0730ab60021f2ce13e (patch) | |
tree | 717f19f039e2319d93159ca0e602165bac7dbf44 /Lib/test/test_threading.py | |
parent | 1bd52d745b16c1a41dd63869264315a4d138f62f (diff) | |
download | cpython-git-8856ddae2522c644132b5d0730ab60021f2ce13e.tar.gz |
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r-- | Lib/test/test_threading.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 30aa9d5786..b9747151b0 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -3,6 +3,7 @@ import test.test_support from test.test_support import verbose import random +import re import sys import threading import thread @@ -72,6 +73,8 @@ class ThreadTests(unittest.TestCase): for i in range(NUMTASKS): t = TestThread("<thread %d>"%i, self, sema, mutex, numrunning) threads.append(t) + self.failUnlessEqual(t.getIdent(), None) + self.assert_(re.match('<TestThread\(.*, initial\)>', repr(t))) t.start() if verbose: @@ -79,6 +82,8 @@ class ThreadTests(unittest.TestCase): for t in threads: t.join(NUMTASKS) self.assert_(not t.isAlive()) + self.failIfEqual(t.getIdent(), 0) + self.assert_(re.match('<TestThread\(.*, \w+ -?\d+\)>', repr(t))) if verbose: print 'all tasks done' self.assertEqual(numrunning.get(), 0) |