コード例 #1
0
 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'])
コード例 #2
0
 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'])
コード例 #3
0
    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, ())
コード例 #4
0
  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, ())
コード例 #5
0
 def test_insert__marks_dirty(self):
     d = Dropdown(['a'])
     with self.assertMarksDirty(d):
         d.insert(1, 'b')
コード例 #6
0
 def test_insert__marks_dirty(self):
   d = Dropdown(['a'])
   with self.assertMarksDirty(d):
     d.insert(1, 'b')