def test_autocompletecombobox(self): box = AutocompleteCombobox(self.window, completevalues=["Apple", "Pear", "Banana"]) box.pack() self.window.update() box.insert(0, "A") self.window.update() for item in ["A", "Up", "Down", "Left", "Right", "Return"]: box.handle_keyrelease(TestEvent(item)) box.autocomplete(0) box.set_completion_list(["Apply"])
def test_autocompletecombobox(self): box = AutocompleteCombobox(self.window, completevalues=["Apple", "Pear", "Banana"]) box.pack() self.window.update() self.assertIn('completevalues', box.keys()) self.assertEqual(box['completevalues'], sorted(["Apple", "Pear", "Banana"])) box.insert(0, "A") self.window.update() for item in ["A", "Up", "Down", "Left", "Right", "Return"]: box.handle_keyrelease(TestEvent(item)) box.autocomplete(0) box.set_completion_list(["Apply"]) self.assertEqual(box['completevalues'], ["Apply"]) box['completevalues'] = ["Test"] self.assertEqual(box['completevalues'], ["Test"])