MCPcopy Create free account
hub / github.com/python/cpython / test_tcl_indexes

Method test_tcl_indexes

Lib/idlelib/idle_test/test_mainmenu.py:20–38  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

18 self.assertGreaterEqual(len(mainmenu.default_keydefs), 50)
19
20 def test_tcl_indexes(self):
21 # Test tcl patterns used to find menuitem to alter.
22 # On failure, change pattern here and in function(s).
23 # Patterns here have '.*' for re instead of '*' for tcl.
24 for menu, pattern in (
25 ('debug', '.*tack.*iewer'), # PyShell.debug_menu_postcommand
26 ('options', '.*ode.*ontext'), # EW.__init__, CodeContext.toggle...
27 ('options', '.*ine.*umbers'), # EW.__init__, EW.toggle...event.
28 ):
29 with self.subTest(menu=menu, pattern=pattern):
30 for menutup in mainmenu.menudefs:
31 if menutup[0] == menu:
32 break
33 else:
34 self.assertTrue(0, f"{menu} not in menudefs")
35 self.assertTrue(any(re.search(pattern, menuitem[0])
36 for menuitem in menutup[1]
37 if menuitem is not None), # Separator.
38 f"{pattern} not in {menu}")
39
40
41if __name__ == '__main__':

Callers

nothing calls this directly

Calls 4

assertTrueMethod · 0.80
anyFunction · 0.50
subTestMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected