MCPcopy Index your code
hub / github.com/python/cpython / test_bind_class_rebind

Method test_bind_class_rebind

Lib/test/test_tkinter/test_misc.py:1082–1108  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1080 unbind_class('Test', event) # idempotent
1081
1082 def test_bind_class_rebind(self):
1083 event = '<Control-Alt-Key-g>'
1084 bind_class = self.root.bind_class
1085 unbind_class = self.root.unbind_class
1086 self.assertEqual(bind_class('Test'), ())
1087 self.assertEqual(bind_class('Test', event), '')
1088 self.addCleanup(unbind_class, 'Test', event)
1089 def test1(e): pass
1090 def test2(e): pass
1091 def test3(e): pass
1092
1093 funcid = bind_class('Test', event, test1)
1094 funcid2 = bind_class('Test', event, test2, add=True)
1095 script = bind_class('Test', event)
1096 self.assertIn(funcid2, script)
1097 self.assertIn(funcid, script)
1098 self.assertCommandExist(funcid)
1099 self.assertCommandExist(funcid2)
1100
1101 funcid3 = bind_class('Test', event, test3)
1102 script = bind_class('Test', event)
1103 self.assertNotIn(funcid, script)
1104 self.assertNotIn(funcid2, script)
1105 self.assertIn(funcid3, script)
1106 self.assertCommandExist(funcid)
1107 self.assertCommandExist(funcid2)
1108 self.assertCommandExist(funcid3)
1109
1110 def test_bind_all(self):
1111 event = '<Control-Alt-Key-h>'

Callers

nothing calls this directly

Calls 5

assertCommandExistMethod · 0.95
addCleanupMethod · 0.80
assertInMethod · 0.80
assertNotInMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected