Ejemplo n.º 1
0
 def xtest_backslashes_alone(self):
     """
     Should insert a properly numbered backslashes in place of $
     backreferences
     """
     self.assertEquals(r'\0\2\100',
                       _switch_backreferences(r'$0$2$100'))
Ejemplo n.º 2
0
 def xtest_backslashes_in_string(self):
     """
     Should insert a properly numbered backslashes in place of $
     backreferences
     """
     self.assertEquals(r'foo\0bar\2baz\g100boo',
                       _switch_backreferences(r'foo$0bar$2baz$100boo'))
Ejemplo n.º 3
0
 def test_backslash_in_string(self):
     """
     Should insert a properly numbered backslash in place of $ reference
     in midst of string
     """
     self.assertEquals(r'foo\0bar',
                       _switch_backreferences(r'foo$0bar'))
Ejemplo n.º 4
0
 def test_backslash_alone(self):
     """
     Should insert a properly numbered backslash in place of single $
     backreference
     """
     self.assertEquals(r'\0', _switch_backreferences(r'$0'))
Ejemplo n.º 5
0
 def test_not_escapes(self):
     """
     We should not escape $ when it's followed by something else
     """
     self.assertEquals(r'\$foo', _switch_backreferences(r'\$foo'))
Ejemplo n.º 6
0
 def test_escapes(self):
     """
     We should be able to escape $ when followed by numbers
     """
     self.assertEquals('$100', _switch_backreferences(r'\$100'))
Ejemplo n.º 7
0
 def test_no_bs(self):
     """
     Appropriate name.  Should do nothing.
     """
     self.assertEquals('foobar', _switch_backreferences('foobar'))