Example #1
0
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#'])
Example #2
0
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#"])
Example #3
0
 def setUp(self):
     super().setUp()
     self.lexer = GlobalLexer()
Example #4
0
 def setUp(self):
     self.lexer = GlobalLexer()