Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
diff tests/test_algpseudo.py @ 289:6fc7f9c1d89d
Remove the old implementation of explicit token types completely
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 22 May 2026 12:41:08 +0200 |
| parents | 298841bc4dee |
| children | b09873e4df58 |
line wrap: on
line diff
--- a/tests/test_algpseudo.py Fri May 22 12:32:38 2026 +0200 +++ b/tests/test_algpseudo.py Fri May 22 12:41:08 2026 +0200 @@ -577,183 +577,6 @@ r"\EXPR{second expression}}", self.lexer)) - def test_explicit_extended_single_tokentype_1(self): - self.assertTokenStreamEqualComplete( - [("Operator", "%"), - ("Text.Whitespace", "\n"), - ], - pygments.lex(r"\ttx-o:%:", self.lexer)) - - def test_explicit_extended_single_tokentype_2(self): - self.assertTokenStreamEqualComplete( - [("Operator", "{"), - ("Text.Whitespace", "\n"), - ], - pygments.lex(r"\ttx-o{{}", self.lexer)) - - def test_explicit_extended_single_tokentype_3(self): - self.assertTokenStreamEqualComplete( - [("Operator", "<"), - ("Text.Whitespace", "\n"), - ], - pygments.lex(r"\ttx-o<<>", self.lexer)) - - def test_explicit_extended_single_tokentype_4(self): - self.assertTokenStreamEqualComplete( - [("Operator", "("), - ("Text.Whitespace", "\n"), - ], - pygments.lex(r"\ttx-o(()", self.lexer)) - - def test_explicit_extended_multi_tokentype_1(self): - self.assertTokenStreamEqualComplete( - [("Operator", "xxx in A"), - ("Text.Whitespace", "\n"), - ], - pygments.lex(r"\ttx-o/xxx in A/", self.lexer)) - - def test_explicit_extended_multi_tokentype_2(self): - self.assertTokenStreamEqualComplete( - [("Operator", "xxx in B"), - ("Text.Whitespace", "\n"), - ], - pygments.lex(r"\ttx-o{xxx in B}", self.lexer)) - - def test_explicit_extended_multi_tokentype_3(self): - self.assertTokenStreamEqualComplete( - [("Operator", "xxx in C"), - ("Text.Whitespace", "\n"), - ], - pygments.lex(r"\ttx-o<xxx in C>", self.lexer)) - - def test_explicit_extended_multi_tokentype_4(self): - self.assertTokenStreamEqualComplete( - [("Operator", "xxx in D"), - ("Text.Whitespace", "\n"), - ], - pygments.lex(r"\ttx-o(xxx in D)", self.lexer)) - - def test_explicit_tokentype_simple_1(self): - self.assertTokenStreamEqualComplete( - [("Operator", "}"), - ("Operator", "/"), - ("Text.Whitespace", "\n"), - ], - pygments.lex(r"\tt-o/}\tt-o//", self.lexer)) - - def test_explicit_tokentype_simple_2(self): - self.assertTokenStreamEqualComplete( - [("Operator", "\n"), - ("Operator", "/"), - ("Text", " "), - ("Text.Whitespace", "\n"), - ], - pygments.lex("\\tt-o/\n\\tt-o// ", self.lexer)) - - def test_explicit_tokentype_with_remark(self): - self.assertTokenStreamEqualComplete( - [("Operator", u"∈ ∌"), - ("Text", " "), - ("Comment.Single", u"▷"), - ("Comment.Single", u" ∈ ∌ as (ordinary) operators"), - ("Text.Whitespace", "\n"), - ], - pygments.lex( - u"""\\ttx-o<∈ ∌> \\rem ∈ ∌ as (ordinary) operators""", - self.lexer)) - - def test_explicit_tokentype_with_remark_2(self): - self.assertTokenStreamEqualComplete( - [("Operator", "new_operator"), - ("Text", " "), - ("Comment.Single", u"▷"), - ("Comment.Single", " a (synthesized) operator"), - ("Text.Whitespace", "\n"), - ], - pygments.lex( - r"""\ttx-o<new_operator> \rem a (synthesized) operator""", - self.lexer)) - - def test_explicit_tokentype_with_possibly_conflicting_parens(self): - self.assertTokenStreamEqualComplete( - [("Name.Function", u"∈_∌"), - ("Punctuation", "("), - ("Name.Entity", "p1"), - ("Punctuation", ","), - ("Text", " "), - ("Name.Entity", "p2"), - ("Punctuation", ")"), - ("Text.Whitespace", "\n"), - ], - pygments.lex( - u"""\\ttx-nf<∈_∌>(p1, p2)""", - self.lexer)) - - def test_explicit_tokentype_with_possibly_conflicting_parens_2(self): - self.assertTokenStreamEqualComplete( - [("Name.Decorator", "a_Decorator"), - ("Punctuation", "("), - ("Name.Entity", "p1"), - ("Punctuation", ","), - ("Text", " "), - ("Name.Entity", "p2"), - ("Punctuation", ")"), - ("Text", " "), - ("Comment.Single", u"▷"), - ("Comment.Single", " (Python) decorator"), - ("Text.Whitespace", "\n"), - ], - pygments.lex( - r"""\ttx-nd<a_Decorator>(p1, p2) \rem (Python) decorator""", - self.lexer)) - - def test_explicit_tokentype_with_possibly_conflicting_parens_3(self): - self.assertTokenStreamEqualComplete( - [("Name.Decorator", "a_Decorator"), - ("Punctuation", "("), - ("Name.Entity", "p1"), - ("Punctuation", ","), - ("Text", " "), - ("Name.Entity", "p2"), - ("Punctuation", ")"), - ("Text", " "), - ("Comment.Single", u"▷"), - ("Comment.Single", " (Python) annotation"), - ("Text.Whitespace", "\n"), - ], - pygments.lex( - r"""\ttx-nd[a_Decorator](p1, p2) \rem (Python) annotation""", - self.lexer)) - - def test_explicit_tokentype_all_seps(self): - for sep in r"""/?.,:;%|=*+!$"'~_-#@""": - self.assertTokenStreamEqualComplete( - [("Name.Decorator", "word"), - ("Text", sep), - ("Text.Whitespace", "\n"), - ], - pygments.lex( - r"\text{\ttx-nd%sword%s%s}" % (sep, sep, sep), - self.lexer)) - - def test_explicit_tokentype_backslash(self): - self.assertTokenStreamEqualComplete( - [("Name.Decorator", "word"), - ("Text", "\\"), - ("Text", " "), - ("Text.Whitespace", "\n"), - ], - pygments.lex(r"\text{\ttx-nd\word\\ }", self.lexer)) - - def test_explicit_tokentype_error(self): - self.assertTokenStreamEqualComplete( - [("Generic.Error", r"""\ttx-non-existing[a_Decorator]"""), - ("Text.Whitespace", "\n"), - ], - pygments.lex( - r"""\ttx-non-existing[a_Decorator]""", - self.lexer)) - def test_extended_explicit_tokentype_empty(self): self.assertTokenStreamEqualComplete( [("Text.Whitespace", "\n")],
