diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-06-18 10:16:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-18 10:16:42 (GMT) |
commit | 692874cdcc4bde3507c1fec614669dea28b9bb2e (patch) | |
tree | 66ccef6256568b2bc7ae6acfa438822503d8191f /Lib | |
parent | 451cb71cc820cce5f250c507cecf15d34f181157 (diff) | |
download | cpython-692874cdcc4bde3507c1fec614669dea28b9bb2e.zip cpython-692874cdcc4bde3507c1fec614669dea28b9bb2e.tar.gz cpython-692874cdcc4bde3507c1fec614669dea28b9bb2e.tar.bz2 |
[3.13] gh-119897: Add test for lambda generator invocation (GH-120658) (#120673)
gh-119897: Add test for lambda generator invocation (GH-120658)
(cherry picked from commit 73dc1c678eb720c2ced94d2f435a908bb6d18566)
gh-120467: Add test for lambda generator invocation
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Diffstat (limited to 'Lib')
-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 6d36df2..a485a9b 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' |