def test_remove_generator(self): sub_generator = Generator() generator = HTMLChildGenerator() generator.append(sub_generator) generator.append("foo") generator.remove(sub_generator) assert_equal([b"foo"], list(iter(generator)))
def test_remove(self): generator = HTMLChildGenerator() generator.extend_raw(["foo", "bar", "lower < than"]) generator.remove("foo") generator.remove("lower < than") assert_equal([b"bar"], list(iter(generator)))
def test_remove_not_found(self): generator = HTMLChildGenerator() generator.extend(["foo", "bar"]) with assert_raises(ValueError): generator.remove("baz")