https://github.com/python/cpython/commit/73dc1c678eb720c2ced94d2f435a908bb6d18566
commit: 73dc1c678eb720c2ced94d2f435a908bb6d18566
branch: main
author: Irit Katriel <[email protected]>
committer: iritkatriel <[email protected]>
date: 2024-06-18T10:45:23+01:00
summary:

gh-119897: Add test for lambda generator invocation (#120658)

gh-120467: Add test for lambda generator invocation

files:
M Lib/test/test_generators.py

diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index 4598e62122b09c..daa65718bfc905 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -6,6 +6,7 @@
 import unittest
 import weakref
 import inspect
+import types
 
 from test import support
 
@@ -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'

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to