]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-138970: Adjust tests for pegen rule flags (#139107)
authorPetr Viktorin <encukou@gmail.com>
Thu, 18 Sep 2025 11:08:44 +0000 (13:08 +0200)
committerGitHub <noreply@github.com>
Thu, 18 Sep 2025 11:08:44 +0000 (12:08 +0100)
Lib/test/test_peg_generator/test_pegen.py

index 0387b9395611b079618440d9afbb7da2c36a85e9..d03ba07975a61663f23490dd755aa834ff8a2f1e 100644 (file)
@@ -1131,24 +1131,28 @@ class TestGrammarVisualizer(unittest.TestCase):
 
         # Test memo-only rule
         simple_rule = rules['simple_rule']
-        self.assertTrue(simple_rule.memo, "simple_rule should have memo=True")
+        self.assertTrue('memo' in simple_rule.flags,
+                        "simple_rule should have memo")
         self.assertEqual(simple_rule.flags, frozenset(['memo']),
                         f"simple_rule flags should be {'memo'}, got {simple_rule.flags}")
 
         # Test multi-flag rule
         multi_flag_rule = rules['multi_flag_rule']
-        self.assertTrue(multi_flag_rule.memo, "multi_flag_rule should have memo=True")
+        self.assertTrue('memo' in simple_rule.flags,
+                        "multi_flag_rule should have memo")
         self.assertEqual(multi_flag_rule.flags, frozenset({'memo', 'custom', 'test'}),
                         f"multi_flag_rule flags should contain memo, custom, test, got {multi_flag_rule.flags}")
 
         # Test single custom flag rule
         single_custom_rule = rules['single_custom_flag']
-        self.assertFalse(single_custom_rule.memo, "single_custom_flag should have memo=False")
+        self.assertFalse('memo' not in simple_rule.flags,
+                         "single_custom_flag should not have memo")
         self.assertEqual(single_custom_rule.flags, frozenset(['custom']),
                         f"single_custom_flag flags should be {'custom'}, got {single_custom_rule.flags}")
 
         # Test no flags rule
         no_flags_rule = rules['no_flags_rule']
-        self.assertFalse(no_flags_rule.memo, "no_flags_rule should have memo=False")
-        self.assertEqual(no_flags_rule.flags, [],
+        self.assertFalse('memo' not in simple_rule.flags,
+                         "no_flags_rule should not have memo")
+        self.assertEqual(no_flags_rule.flags, frozenset(),
                         f"no_flags_rule flags should be the empty set, got {no_flags_rule.flags}")