def test_insert(self): d = Dropdown(['b']) d.insert(0, 'a') d.insert(99, 'd') d.insert(-1, 'c') self.assertEqual(['a', 'b', 'c', 'd'], list(d)) self.assertHTMLLike(dropdown_xml('a', 'b', 'c', 'd'), d, ignored_attrs=['id', 'onchange', 'selected'])
def test_options_must_be_strings(self): with self.assertRaises(TypeError): Dropdown([()]) d = Dropdown(['a']) with self.assertRaises(TypeError): d[0] = () with self.assertRaises(TypeError): d.insert(0, ())
def test_insert__marks_dirty(self): d = Dropdown(['a']) with self.assertMarksDirty(d): d.insert(1, 'b')