Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
comparison tests/test_algpseudo.py @ 75:711f8d19e27a
New implementation of "STATEMENT" (also aliased to "STATE" and "BLOCK").
Now this needs curly braces.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 29 Apr 2026 12:43:28 +0200 |
| parents | c1357674622d |
| children | 27e12387154d |
comparison
equal
deleted
inserted
replaced
| 74:c1357674622d | 75:711f8d19e27a |
|---|---|
| 328 pygments.lex( | 328 pygments.lex( |
| 329 r"""a \TEXT{multiplied by {escaped\} } b \text{is \ not} 0""" | 329 r"""a \TEXT{multiplied by {escaped\} } b \text{is \ not} 0""" |
| 330 r" \text{mod} p""", | 330 r" \text{mod} p""", |
| 331 self.lexer)) | 331 self.lexer)) |
| 332 | 332 |
| 333 def test_punctuation(self): | |
| 334 self.assertTokenStreamEqualComplete( | |
| 335 [("Punctuation", "{"), | |
| 336 ("Punctuation", "}"), | |
| 337 ("Punctuation", ":"), | |
| 338 ("Punctuation", "("), | |
| 339 ("Punctuation", ")"), | |
| 340 ("Punctuation", ","), | |
| 341 ("Punctuation", ";"), | |
| 342 ("Punctuation", "["), | |
| 343 ("Punctuation", "]"), | |
| 344 ("Text.Whitespace", "\n"), | |
| 345 ], | |
| 346 pygments.lex(r"{}:(),;[]", self.lexer)) | |
| 347 | |
| 348 def test_block_empty(self): | |
| 349 self.assertTokenStreamEqualComplete( | |
| 350 [("Text", "◆"), | |
| 351 ("Text.Whitespace", " "), | |
| 352 ("Text.Whitespace", "\n"), | |
| 353 ], | |
| 354 pygments.lex(r"\block{}", self.lexer)) | |
| 355 | |
| 356 def test_block_with_text(self): | |
| 357 self.assertTokenStreamEqualComplete( | |
| 358 [("Text", "◆"), | |
| 359 ("Text.Whitespace", " "), | |
| 360 ("Text", "a b c"), | |
| 361 ("Text.Whitespace", "\n"), | |
| 362 ], | |
| 363 pygments.lex(r"\block{\text{a b c}}", self.lexer)) | |
| 364 | |
| 365 def test_block(self): | |
| 366 self.assertTokenStreamEqualComplete( | |
| 367 [("Text", "◆"), | |
| 368 ("Text.Whitespace", " "), | |
| 369 ("Name.Entity", "a"), | |
| 370 ("Text", " "), | |
| 371 ("Number.Float", "1.2"), | |
| 372 ("Text", " "), | |
| 373 ("Punctuation", "{"), | |
| 374 ("Name.Entity", "x"), | |
| 375 ("Text", " "), | |
| 376 ("Operator.Word", "in"), | |
| 377 ("Text", " "), | |
| 378 ("Name.Entity", "X"), | |
| 379 ("Punctuation", "}"), | |
| 380 ("Text", " "), | |
| 381 ("Name.Entity", "c"), | |
| 382 ("Text.Whitespace", "\n"), | |
| 383 ], | |
| 384 pygments.lex(r"\state{a 1.2 {x in X\} c}", self.lexer)) | |
| 385 | |
| 333 | 386 |
| 334 class PygmentizeCompletely(unittest.TestCase): | 387 class PygmentizeCompletely(unittest.TestCase): |
| 335 | 388 |
| 336 def setUp(self): | 389 def setUp(self): |
| 337 self.lexer = pygments.lexers.load_lexer_from_file( | 390 self.lexer = pygments.lexers.load_lexer_from_file( |
