From 468255554fdc97f3e23e425344a0bf0e58d92c12 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Sun, 26 Nov 2023 23:42:48 +0000 Subject: [PATCH] add test for getgeneratorstate as well --- Lib/test/test_inspect/test_inspect.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/test/test_inspect/test_inspect.py b/Lib/test/test_inspect/test_inspect.py index 38ba86f4ae49b6..e75682f881ab34 100644 --- a/Lib/test/test_inspect/test_inspect.py +++ b/Lib/test/test_inspect/test_inspect.py @@ -2384,6 +2384,10 @@ def test_closed_after_immediate_exception(self): self.generator.throw(RuntimeError) self.assertEqual(self._generatorstate(), inspect.GEN_CLOSED) + def test_closed_after_close(self): + self.generator.close() + self.assertEqual(self._generatorstate(), inspect.GEN_CLOSED) + def test_running(self): # As mentioned on issue #10220, checking for the RUNNING state only # makes sense inside the generator itself.