diff options
author | gbrandl <devnull@localhost> | 2007-01-12 15:52:16 +0100 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2007-01-12 15:52:16 +0100 |
commit | 65750ddadbe26b140083030b6ac062e1af4a79b0 (patch) | |
tree | 885e79d13567fc851b2b1645be5ee2e5ee6732de /tests/test_basic_api.py | |
parent | bd84c9eca33ecd0d0a7994f085584f79affbf3f0 (diff) | |
download | pygments-65750ddadbe26b140083030b6ac062e1af4a79b0.tar.gz |
[svn] Add test for lexer attribute types.
Diffstat (limited to 'tests/test_basic_api.py')
-rw-r--r-- | tests/test_basic_api.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py index 05371130..2a967317 100644 --- a/tests/test_basic_api.py +++ b/tests/test_basic_api.py @@ -31,8 +31,11 @@ class LexersTest(unittest.TestCase): ae = self.assertEquals # test that every lexer class has the correct public API for lexer in lexers._iter_lexerclasses(): - for attr in 'name', 'aliases', 'filenames', 'alias_filenames', 'mimetypes': + a(type(lexer.name) is str) + for attr in 'aliases', 'filenames', 'alias_filenames', 'mimetypes': a(hasattr(lexer, attr)) + a(type(getattr(lexer, attr)) is list, "%s: %s attribute wrong" % + (lexer, attr)) result = lexer.analyse_text("abc") a(isinstance(result, float) and 0.0 <= result <= 1.0) |