##// END OF EJS Templates
Closes #7558: Added a rule for cell magics.
Lev Abalkin -
Show More
@@ -49,6 +49,7 b' from IPython.testing.skipdoctest import skip_doctest'
49 line_re = re.compile('.*?\n')
49 line_re = re.compile('.*?\n')
50
50
51 ipython_tokens = [
51 ipython_tokens = [
52 (r"(?s)(\s*)(%%)(\w+)(.*)", bygroups(Text, Operator, Keyword, Text)),
52 (r'(%)(sx|sc|system)(.*)(\n)', bygroups(Operator, Keyword,
53 (r'(%)(sx|sc|system)(.*)(\n)', bygroups(Operator, Keyword,
53 using(BashLexer), Text)),
54 using(BashLexer), Text)),
54 (r'(%)(\w+)(.*\n)', bygroups(Operator, Keyword, Text)),
55 (r'(%)(\w+)(.*\n)', bygroups(Operator, Keyword, Text)),
@@ -77,3 +77,12 b' class TestLexers(TestsBase):'
77 (Token.Text, ' function () {}\n'),
77 (Token.Text, ' function () {}\n'),
78 ]
78 ]
79 self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
79 self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
80
81 fragment_2 = '\t%%xyz\n$foo\n'
82 tokens_2 = [
83 (Token.Text, '\t'),
84 (Token.Operator, '%%'),
85 (Token.Keyword, 'xyz'),
86 (Token.Text, '\n$foo\n'),
87 ]
88 self.assertEqual(tokens_2, list(self.lexer.get_tokens(fragment_2)))
General Comments 0
You need to be logged in to leave comments. Login now