diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2024-06-18 09:45:23 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-18 09:45:23 (GMT) |
commit | 73dc1c678eb720c2ced94d2f435a908bb6d18566 (patch) | |
tree | 2b11a45481740882bc0eb148ef6d5d0c81bc4ca7 /Lib/test | |
parent | 2cf47389e26cb591342d07dad98619916d5a1b15 (diff) | |
download | cpython-73dc1c678eb720c2ced94d2f435a908bb6d18566.zip cpython-73dc1c678eb720c2ced94d2f435a908bb6d18566.tar.gz cpython-73dc1c678eb720c2ced94d2f435a908bb6d18566.tar.bz2 |
gh-119897: Add test for lambda generator invocation (#120658)
gh-120467: Add test for lambda generator invocation
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_generators.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index 4598e62..daa6571 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -6,6 +6,7 @@ import doctest import unittest import weakref import inspect +import types from test import support @@ -89,9 +90,12 @@ class FinalizationTest(unittest.TestCase): self.assertEqual(gc.garbage, old_garbage) def test_lambda_generator(self): - # Issue #23192: Test that a lambda returning a generator behaves + # bpo-23192, gh-119897: Test that a lambda returning a generator behaves # like the equivalent function f = lambda: (yield 1) + self.assertIsInstance(f(), types.GeneratorType) + self.assertEqual(next(f()), 1) + def g(): return (yield 1) # test 'yield from' |