class TestGlobalLexer(unittest.TestCase): def setUp(self): self.lexer = GlobalLexer() def testCanMatchFullPattern(self): actual = self.lexer.parse(r'/foo/p#') self.assertEqual(actual, ['foo', 'p#']) def testCanMatchEmtpySearch(self): actual = self.lexer.parse(r'//p#') self.assertEqual(actual, ['', 'p#']) def testCanEscapeCharactersInSearchPattern(self): actual = self.lexer.parse(r'/\/foo\//p#') self.assertEqual(actual, ['/foo/', 'p#']) def testCanEscapeBackSlashes(self): actual = self.lexer.parse(r'/\\/p#') self.assertEqual(actual, ['\\', 'p#'])
def setUp(self): self.lexer = GlobalLexer()