diff options
| author | Georg Brandl <georg@python.org> | 2019-05-06 08:17:53 +0200 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2019-11-10 10:15:13 +0100 |
| commit | a41f232a0aa9f2b435e54a7e247c858a8f2d7fa8 (patch) | |
| tree | 8245310d57e48e3e966a46f40e120d6ea3ce28f7 /tests/test_javascript.py | |
| parent | 7b418bd18e01b06ccaa1c7bd03d11abf303f2fbd (diff) | |
| download | pygments-git-a41f232a0aa9f2b435e54a7e247c858a8f2d7fa8.tar.gz | |
Initial port to py.test
Unittest classes are kept - for now - since py.test is ok with them.
Generator tests had to be switched to pytest parametrized tests.
Diffstat (limited to 'tests/test_javascript.py')
| -rw-r--r-- | tests/test_javascript.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/test_javascript.py b/tests/test_javascript.py index a2dfb7e1..0e279d93 100644 --- a/tests/test_javascript.py +++ b/tests/test_javascript.py @@ -9,6 +9,8 @@ import unittest +import pytest + from pygments.lexers import CoffeeScriptLexer from pygments.token import Token @@ -36,11 +38,10 @@ COFFEE_SLASH_GOLDEN = [ ('a = 1 + /d/.test(a)', True), ] -def test_coffee_slashes(): - for input_str, slashes_are_regex_here in COFFEE_SLASH_GOLDEN: - yield coffee_runner, input_str, slashes_are_regex_here -def coffee_runner(input_str, slashes_are_regex_here): +@pytest.mark.parametrize('golden', COFFEE_SLASH_GOLDEN) +def test_coffee_slashes(golden): + input_str, slashes_are_regex_here = golden lex = CoffeeScriptLexer() output = list(lex.get_tokens(input_str)) print(output) @@ -49,6 +50,7 @@ def coffee_runner(input_str, slashes_are_regex_here): is_regex = t is Token.String.Regex assert is_regex == slashes_are_regex_here, (t, s) + class CoffeeTest(unittest.TestCase): def setUp(self): self.lexer = CoffeeScriptLexer() |
