diff options
author | Matth?us G. Chajdas <dev@anteru.net> | 2019-11-10 13:56:53 +0100 |
---|---|---|
committer | Matth?us G. Chajdas <dev@anteru.net> | 2019-11-10 13:56:53 +0100 |
commit | 1dd3124a9770e11b6684e5dd1e6bc15a0aa3bc67 (patch) | |
tree | 87a171383266dd1f64196589af081bc2f8e497c3 /tests/test_inherit.py | |
parent | f1c080e184dc1bbc36eaa7cd729ff3a499de568a (diff) | |
download | pygments-master.tar.gz |
Diffstat (limited to 'tests/test_inherit.py')
-rw-r--r-- | tests/test_inherit.py | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/tests/test_inherit.py b/tests/test_inherit.py deleted file mode 100644 index 38acf328..00000000 --- a/tests/test_inherit.py +++ /dev/null @@ -1,94 +0,0 @@ -# -*- coding: utf-8 -*- -""" - Tests for inheritance in RegexLexer - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -import unittest - -from pygments.lexer import RegexLexer, inherit -from pygments.token import Text - - -class InheritTest(unittest.TestCase): - def test_single_inheritance_position(self): - t = Two() - pats = [x[0].__self__.pattern for x in t._tokens['root']] - self.assertEqual(['x', 'a', 'b', 'y'], pats) - def test_multi_inheritance_beginning(self): - t = Beginning() - pats = [x[0].__self__.pattern for x in t._tokens['root']] - self.assertEqual(['x', 'a', 'b', 'y', 'm'], pats) - def test_multi_inheritance_end(self): - t = End() - pats = [x[0].__self__.pattern for x in t._tokens['root']] - self.assertEqual(['m', 'x', 'a', 'b', 'y'], pats) - - def test_multi_inheritance_position(self): - t = Three() - pats = [x[0].__self__.pattern for x in t._tokens['root']] - self.assertEqual(['i', 'x', 'a', 'b', 'y', 'j'], pats) - - def test_single_inheritance_with_skip(self): - t = Skipped() - pats = [x[0].__self__.pattern for x in t._tokens['root']] - self.assertEqual(['x', 'a', 'b', 'y'], pats) - - -class One(RegexLexer): - tokens = { - 'root': [ - ('a', Text), - ('b', Text), - ], - } - -class Two(One): - tokens = { - 'root': [ - ('x', Text), - inherit, - ('y', Text), - ], - } - -class Three(Two): - tokens = { - 'root': [ - ('i', Text), - inherit, - ('j', Text), - ], - } - -class Beginning(Two): - tokens = { - 'root': [ - inherit, - ('m', Text), - ], - } - -class End(Two): - tokens = { - 'root': [ - ('m', Text), - inherit, - ], - } - -class Empty(One): - tokens = {} - -class Skipped(Empty): - tokens = { - 'root': [ - ('x', Text), - inherit, - ('y', Text), - ], - } - |