Ejemplo n.º 1
0
 def test_empty(self):
     generator = HTMLChildGenerator()
     generator.append(u"c1")
     generator.extend([u"c2", u"c3", NullGenerator()])
     generator.empty()
     assert_equal([], list(iter(generator)))
Ejemplo n.º 2
0
 def test_remove_raw_not_found(self):
     generator = HTMLChildGenerator()
     generator.extend(["foo", "bar"])
     with assert_raises(ValueError):
         generator.remove_raw("baz")
Ejemplo n.º 3
0
 def test_len(self):
     generator = HTMLChildGenerator()
     generator.append(u"c1")
     generator.extend([u"c2", u"c3", NullGenerator()])
     assert_equal(4, len(generator))
Ejemplo n.º 4
0
 def test_extend(self):
     generator = HTMLChildGenerator()
     generator.append(u"c1")
     generator.extend([_TestingGenerator([u"c2", u"c&3"]), u"<c4>"])
     assert_equal([b"c1", b"c2", b"c&3", b"&lt;c4&gt;"],
                  list(iter(generator)))