Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 692874c

Browse files
[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 73dc1c6) gh-120467: Add test for lambda generator invocation Co-authored-by: Irit Katriel <[email protected]>
1 parent 451cb71 commit 692874c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Lib/test/test_generators.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import unittest
77
import weakref
88
import inspect
9+
import types
910

1011
from test import support
1112

@@ -89,9 +90,12 @@ def gen():
8990
self.assertEqual(gc.garbage, old_garbage)
9091

9192
def test_lambda_generator(self):
92-
# Issue #23192: Test that a lambda returning a generator behaves
93+
# bpo-23192, gh-119897: Test that a lambda returning a generator behaves
9394
# like the equivalent function
9495
f = lambda: (yield 1)
96+
self.assertIsInstance(f(), types.GeneratorType)
97+
self.assertEqual(next(f()), 1)
98+
9599
def g(): return (yield 1)
96100

97101
# test 'yield from'

0 commit comments

Comments
 (0)