summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_inspect.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2010-11-30 06:36:04 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2010-11-30 06:36:04 (GMT)
commit7921b9f2104fee46413798d0a82a1e822f061957 (patch)
treeaca8c35d47905f3f4b132aa69b137301ced387ea /Lib/test/test_inspect.py
parent234515afe594e5f9ca1b3f460735c68b04c031e2 (diff)
downloadcpython-7921b9f2104fee46413798d0a82a1e822f061957.zip
cpython-7921b9f2104fee46413798d0a82a1e822f061957.tar.gz
cpython-7921b9f2104fee46413798d0a82a1e822f061957.tar.bz2
Issue 10220: switch to using string constants rather than integers for inspect.getgeneratorstate() return values and make debugging friendly str() and repr() for generator states a requirement in the test suite
Diffstat (limited to 'Lib/test/test_inspect.py')
-rw-r--r--Lib/test/test_inspect.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 97c47ac..71f0e8a 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -931,6 +931,14 @@ class TestGetGeneratorState(unittest.TestCase):
# Running after the first yield
next(self.generator)
+ def test_easy_debugging(self):
+ # repr() and str() of a generator state should contain the state name
+ names = 'GEN_CREATED GEN_RUNNING GEN_SUSPENDED GEN_CLOSED'.split()
+ for name in names:
+ state = getattr(inspect, name)
+ self.assertIn(name, repr(state))
+ self.assertIn(name, str(state))
+
def test_main():
run_unittest(