Lines Matching refs:self
3 # testing skipping of suite when self.needwrapbutton is false.
39 def setUp(self):
40 self.engine = se.SearchEngine(self.root) # None also seems to work
41 self.dialog = sdb.SearchDialogBase(root=self.root, engine=self.engine)
43 def tearDown(self):
44 self.dialog.close()
46 def test_open_and_close(self):
48 self.dialog.default_command = None
50 toplevel = Toplevel(self.root)
52 self.dialog.open(text)
53 self.assertEqual(self.dialog.top.state(), 'normal')
54 self.dialog.close()
55 self.assertEqual(self.dialog.top.state(), 'withdrawn')
57 self.dialog.open(text, searchphrase="hello")
58 self.assertEqual(self.dialog.ent.get(), 'hello')
62 def test_create_widgets(self):
63 self.dialog.create_entries = Func()
64 self.dialog.create_option_buttons = Func()
65 self.dialog.create_other_buttons = Func()
66 self.dialog.create_command_buttons = Func()
68 self.dialog.default_command = None
69 self.dialog.create_widgets()
71 self.assertTrue(self.dialog.create_entries.called)
72 self.assertTrue(self.dialog.create_option_buttons.called)
73 self.assertTrue(self.dialog.create_other_buttons.called)
74 self.assertTrue(self.dialog.create_command_buttons.called)
76 def test_make_entry(self):
77 equal = self.assertEqual
78 self.dialog.row = 0
79 self.dialog.frame = Frame(self.root)
80 entry, label = self.dialog.make_entry("Test:", 'hello')
83 self.assertIn(entry.get(), 'hello')
89 equal(self.dialog.row, 1)
91 def test_create_entries(self):
92 self.dialog.frame = Frame(self.root)
93 self.dialog.row = 0
94 self.engine.setpat('hello')
95 self.dialog.create_entries()
96 self.assertIn(self.dialog.ent.get(), 'hello')
98 def test_make_frame(self):
99 self.dialog.row = 0
100 self.dialog.frame = Frame(self.root)
101 frame, label = self.dialog.make_frame()
102 self.assertEqual(label, '')
103 self.assertEqual(str(type(frame)), "<class 'tkinter.ttk.Frame'>")
104 # self.assertIsInstance(frame, Frame) fails when test is run by
107 frame, label = self.dialog.make_frame('testlabel')
108 self.assertEqual(label['text'], 'testlabel')
110 def btn_test_setup(self, meth):
111 self.dialog.frame = Frame(self.root)
112 self.dialog.row = 0
115 def test_create_option_buttons(self):
116 e = self.engine
120 frame, options = self.btn_test_setup(
121 self.dialog.create_option_buttons)
124 self.assertEqual(button['text'], label)
125 self.assertEqual(var.get(), state)
127 def test_create_other_buttons(self):
129 var = self.engine.backvar
131 frame, others = self.btn_test_setup(
132 self.dialog.create_other_buttons)
136 self.assertEqual(button['text'], label)
140 self.assertEqual(var.get(), state)
142 def test_make_button(self):
143 self.dialog.frame = Frame(self.root)
144 self.dialog.buttonframe = Frame(self.dialog.frame)
145 btn = self.dialog.make_button('Test', self.dialog.close)
146 self.assertEqual(btn['text'], 'Test')
148 def test_create_command_buttons(self):
149 self.dialog.frame = Frame(self.root)
150 self.dialog.create_command_buttons()
153 for child in self.dialog.buttonframe.winfo_children():
156 self.assertIn('close', closebuttoncommand)