__revision__ = "$Rev: 421 $" __author__ = "David Stanek " __copyright__ = "Copyright 2005, David Stanek" import kid def test_strip_no_expr(): """A py:strip without an expression will strip that element.""" source = """ stuff """ data = kid.Template(source=source).serialize() assert "wrapper" not in data assert "present" in data def test_strip_with_boolean_expression__or(): """Test for the bug that was reported in ticket #97.""" source_template = """ content content """ t = kid.Template(source=source_template % (True, True)) assert "" not in t.serialize() t = kid.Template(source=source_template % (True, False)) assert "" not in t.serialize() t = kid.Template(source=source_template % (False, True)) assert "" not in t.serialize() t = kid.Template(source=source_template % (False, False)) assert t.serialize().count("") == 2 def test_strip_with_boolean_expression__eq(): source = """ """ data = kid.Template(source=source).serialize() assert " you will never see this """ data = kid.Template(source=source).serialize() assert "wrapper" not in data assert "x" in data def test_replace_with_strip(): """py:strip as ignored if py:replace exists in the same element.""" source = """ content """ data = kid.Template(source=source).serialize() assert "wrapper" not in data assert "x" in data def test_attr(): source = """ """ data = kid.Template(source=source).serialize() assert data.count('') == 4 def test_attr_with_strip(): source = """ """ data = kid.Template(source=source).serialize() print data assert 'a="1"' in data assert 'b="2"' in data