Ejemplo n.º 1
0
    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)))
Ejemplo n.º 2
0
    def test_unescape_no_escape(self):
        """Tests that Name.unescape for unescaped string returns the input
        string"""
        s = 'hello world'
        expected = s

        self.assertEqual(expected, Name.unescape(s))
Ejemplo n.º 3
0
    def test_unescape_no_escape(self):
        """Tests that Name.unescape for unescaped string returns the input
        string"""
        s = 'hello world'
        expected = s

        self.assertEqual(
            expected, Name.unescape(s))
Ejemplo n.º 4
0
def Name_unescape2():
    """Tests that Name.unescape for escaped string with invalid escape seqienmce
    raises ValueError"""
    with assert_exception(ValueError):
        Name.unescape('#01')
Ejemplo n.º 5
0
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)))
Ejemplo n.º 6
0
def Name_unescape0():
    """Tests that Name.unescape for unescaped string returns the input string"""
    s = 'hello world'
    expected = s

    assert_eq(expected, Name.unescape(s))
Ejemplo n.º 7
0
 def test_unescape_invalid_escape(self):
     """Tests that Name.unescape for escaped string with invalid escape seqienmce
     raises ValueError"""
     with self.assertRaises(ValueError):
         Name.unescape('#01')
Ejemplo n.º 8
0
def Name_unescape2():
    """Tests that Name.unescape for escaped string with invalid escape seqienmce
    raises ValueError"""
    with assert_exception(ValueError):
        Name.unescape('#01')
Ejemplo n.º 9
0
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)))
Ejemplo n.º 10
0
def Name_unescape0():
    """Tests that Name.unescape for unescaped string returns the input string"""
    s = 'hello world'
    expected = s

    assert_eq(expected, Name.unescape(s))
Ejemplo n.º 11
0
 def test_unescape_invalid_escape(self):
     """Tests that Name.unescape for escaped string with invalid escape seqienmce
     raises ValueError"""
     with self.assertRaises(ValueError):
         Name.unescape('#01')
Ejemplo n.º 12
0
    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)))