def test_escape_2(self): assert escape(b'1234#09*xyz') == b'1234}\x0309}\x0axyz'
def test_escape_passthrough(self, data): assert escape(data) == data
def test_escape_1(self, data, expected): assert escape(data) == expected
def test_escape_combined(self): assert escape(b"#$}*") == b"}\x03}\x04}]}\x0a" assert escape(b'}}}') == b"}]}]}]"
def test_escape_single(self): assert escape(b"#") == b"}\x03" assert escape(b"$") == b"}\x04" assert escape(b"}") == b"}]" assert escape(b"*") == b"}\x0a"
def test_escape_individual(self): assert escape(b"hello#foo") == b"hello}\x03foo" assert escape(b"hello$foo") == b"hello}\x04foo" assert escape(b"hello}foo") == b"hello}]foo" assert escape(b"hello*foo") == b"hello}\x0afoo"
def test_escape_transparent(self): assert escape(b"hello") == b"hello"