def test_illegal_chars_in_xml(self): for c in u'\x00\x08\x0B\x0C\x0E\x1F\uFFFE\uFFFF': assert_equals(attribute_escape(c), '')
def test_html_entities(self): for inp, exp in [('"', '"'), ('<', '<'), ('>', '>'), ('&', '&'), ('&<">&', '&<">&'), ('Sanity < "check"', 'Sanity < "check"')]: assert_equals(attribute_escape(inp), exp)
def test_newlines_and_tabs(self): for inp, exp in [('\n', ' '), ('\t', '	'), ('"\n\t"', '" 	"'), ('N1\nN2\n\nT1\tT3\t\t\t', 'N1 N2 T1	T3			')]: assert_equals(attribute_escape(inp), exp)
def test_nothing_to_escape(self): for inp in ['', 'whatever', 'nothing here, move along']: assert_equals(attribute_escape(inp), inp)
def test_illegal_chars_in_xml(self): for c in u'\x00\x08\x0B\x0C\x0E\x1F\uFFFE\uFFFF': assert_equal(attribute_escape(c), '')
def test_newlines_and_tabs(self): for inp, exp in [('\n', ' '), ('\t', '	'), ('"\n\t"', '" 	"'), ('N1\nN2\n\nT1\tT3\t\t\t', 'N1 N2 T1	T3			')]: assert_equal(attribute_escape(inp), exp)
def test_html_entities(self): for inp, exp in [('"', '"'), ('<', '<'), ('>', '>'), ('&', '&'), ('&<">&', '&<">&'), ('Sanity < "check"', 'Sanity < "check"') ]: assert_equal(attribute_escape(inp), exp)
def test_nothing_to_escape(self): for inp in ['', 'whatever', 'nothing here, move along']: assert_equal(attribute_escape(inp), inp)