diff options
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_pep380.py | 23 | ||||
-rw-r--r-- | Lib/test/test_sys.py | 2 |
2 files changed, 23 insertions, 2 deletions
diff --git a/Lib/test/test_pep380.py b/Lib/test/test_pep380.py index bdcfacd..658bcb9 100644 --- a/Lib/test/test_pep380.py +++ b/Lib/test/test_pep380.py @@ -10,7 +10,7 @@ see <http://www.cosc.canterbury.ac.nz/greg.ewing/python/yield-from/YieldFrom-Pyt import unittest import io import sys -import traceback +import inspect import parser from test.support import captured_stderr @@ -919,6 +919,27 @@ class TestPEP380Operation(unittest.TestCase): next(g1) g1.close() + def test_delegator_is_visible_to_debugger(self): + def call_stack(): + return [f[3] for f in inspect.stack()] + + def gen(): + yield call_stack() + yield call_stack() + yield call_stack() + + def spam(g): + yield from g + + def eggs(g): + yield from g + + for stack in spam(gen()): + self.assertTrue('spam' in stack) + + for stack in spam(eggs(gen())): + self.assertTrue('spam' in stack and 'eggs' in stack) + def test_main(): from test import support diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 9f6af7f..2afc261 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -730,7 +730,7 @@ class SizeofTest(unittest.TestCase): nfrees = len(x.f_code.co_freevars) extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\ ncells + nfrees - 1 - check(x, size(vh + '13P3i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P')) + check(x, size(vh + '12P3i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P')) # function def func(): pass check(func, size(h + '12P')) |