def Name_escape0(): """Tests that Name.escape for string not needing escaping returns the input string""" s = 'hello world' expected = s assert_eq(expected, Name.escape(s))
def Name_escape1(): """Tests that Name.escape for string needing escaping returns the correct string""" s = 'hello, "world"; insert <token + value>' expected = 'hello#2C #22world#22#3B insert #3Ctoken #2B value#3E' assert_eq(expected, Name.escape(s))
def test_unescape_with_escape(self): """Tests that Name.unescape for escaped string returns the correct string""" s = 'hello, "world"; insert <token + value>' self.assertEqual( s, Name.unescape(Name.escape(s)))
def test_escape_with_escape(self): """Tests that Name.escape for string needing escaping returns the correct string""" s = 'hello, "world"; insert <token + value>' expected = 'hello#2C #22world#22#3B insert #3Ctoken #2B value#3E' self.assertEqual(expected, Name.escape(s))
def test_escape_no_escape(self): """Tests that Name.escape for string not needing escaping returns the input string""" s = 'hello world' expected = s self.assertEqual(expected, Name.escape(s))
def test_escape_with_escape(self): """Tests that Name.escape for string needing escaping returns the correct string""" s = 'hello, "world"; insert <token + value>' expected = 'hello#2C #22world#22#3B insert #3Ctoken #2B value#3E' self.assertEqual( expected, Name.escape(s))
def test_escape_no_escape(self): """Tests that Name.escape for string not needing escaping returns the input string""" s = 'hello world' expected = s self.assertEqual( expected, Name.escape(s))
def Name_unescape1(): """Tests that Name.unescape for escaped string returns the correct string""" s = 'hello, "world"; insert <token + value>' assert_eq(s, Name.unescape(Name.escape(s)))
def test_unescape_with_escape(self): """Tests that Name.unescape for escaped string returns the correct string""" s = 'hello, "world"; insert <token + value>' self.assertEqual(s, Name.unescape(Name.escape(s)))