Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Lib/test/test_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import unittest
import weakref
import inspect
import types

from test import support

Expand Down Expand Up @@ -89,9 +90,12 @@ def gen():
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'
Expand Down