diff options
| author | Georg Brandl <georg@python.org> | 2019-05-06 18:02:47 +0200 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2019-11-10 10:15:13 +0100 |
| commit | 7827966acdb6431636520d20fc3c148ce52de59b (patch) | |
| tree | 13a9316eb3eb964c22da0a08f046d44cd81470d0 /tests/test_cpp.py | |
| parent | a281ff8367a3a5f4cc17c9956e9273593558d336 (diff) | |
| download | pygments-git-7827966acdb6431636520d20fc3c148ce52de59b.tar.gz | |
Remove unittest classes from the test suite.
Diffstat (limited to 'tests/test_cpp.py')
| -rw-r--r-- | tests/test_cpp.py | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/tests/test_cpp.py b/tests/test_cpp.py index ef59965c..b87b2dd3 100644 --- a/tests/test_cpp.py +++ b/tests/test_cpp.py @@ -7,27 +7,29 @@ :license: BSD, see LICENSE for details. """ -import unittest +import pytest from pygments.lexers import CppLexer from pygments.token import Token -class CppTest(unittest.TestCase): - def setUp(self): - self.lexer = CppLexer() - - def testGoodComment(self): - fragment = u'/* foo */\n' - tokens = [ - (Token.Comment.Multiline, u'/* foo */'), - (Token.Text, u'\n'), - ] - self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) - - def testOpenComment(self): - fragment = u'/* foo\n' - tokens = [ - (Token.Comment.Multiline, u'/* foo\n'), - ] - self.assertEqual(tokens, list(self.lexer.get_tokens(fragment))) +@pytest.fixture(scope='module') +def lexer(): + yield CppLexer() + + +def test_good_comment(lexer): + fragment = u'/* foo */\n' + tokens = [ + (Token.Comment.Multiline, u'/* foo */'), + (Token.Text, u'\n'), + ] + assert list(lexer.get_tokens(fragment)) == tokens + + +def test_open_comment(lexer): + fragment = u'/* foo\n' + tokens = [ + (Token.Comment.Multiline, u'/* foo\n'), + ] + assert list(lexer.get_tokens(fragment)) == tokens |
