def test_autocompleteentry(self):
     entry = AutocompleteEntry(self.window,
                               completevalues=["Apple", "Pear", "Banana"])
     entry.pack()
     self.window.update()
     entry.insert(0, "A")
     self.window.update()
     for item in ["A", "Up", "Down", "Left", "Right", "Return"]:
         entry.handle_keyrelease(TestEvent(item))
     entry.autocomplete(0)
     entry.set_completion_list(["Apply"])
    def test_autocompleteentry(self):
        entry = AutocompleteEntry(self.window, completevalues=["Apple", "Pear", "Banana"])
        entry.pack()
        self.window.update()

        self.assertIn('completevalues', entry.keys())
        self.assertEqual(entry['completevalues'], sorted(["Apple", "Pear", "Banana"]))

        entry.insert(0, "A")
        self.window.update()
        for item in ["A", "Up", "Down", "Left", "Right", "Return"]:
            entry.handle_keyrelease(TestEvent(item))
        entry.autocomplete(0)
        entry.set_completion_list(["Apply"])
        self.assertEqual(entry['completevalues'], ["Apply"])
        entry['completevalues'] = ["Test"]
        self.assertEqual(entry['completevalues'], ["Test"])