From 98152425e1dcc3cc9e6a283a32b788026c2baad4 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 4 Jan 2011 21:35:09 +0100 Subject: Temporarily disable extensive testing of the XQuery lexer. --- tests/test_basic_api.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/test_basic_api.py') diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py index e8b9cf9a..1e7dff14 100644 --- a/tests/test_basic_api.py +++ b/tests/test_basic_api.py @@ -55,6 +55,9 @@ def test_lexer_classes(): assert 'root' in cls._tokens, \ '%s has no root state' % cls + if cls.name == 'XQuery': # XXX temporary + return + tokens = list(inst.get_tokens(test_content)) txt = "" for token in tokens: -- cgit v1.2.1 From b8ab0806c54074c60fd005cf07777f65e8f8dd2c Mon Sep 17 00:00:00 2001 From: Tim Van Steenburgh Date: Thu, 26 May 2011 16:09:37 -0400 Subject: Fix bug in GasLexer.analyse_text(). Make sure return val can be cast to float. --- tests/test_basic_api.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/test_basic_api.py') diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py index 1e7dff14..a90d0a83 100644 --- a/tests/test_basic_api.py +++ b/tests/test_basic_api.py @@ -42,6 +42,8 @@ def test_lexer_classes(): "%s: %s attribute wrong" % (cls, attr) result = cls.analyse_text("abc") assert isinstance(result, float) and 0.0 <= result <= 1.0 + result = cls.analyse_text(".abc") + assert isinstance(result, float) and 0.0 <= result <= 1.0 inst = cls(opt1="val1", opt2="val2") if issubclass(cls, RegexLexer): -- cgit v1.2.1 From 40c69ec2d55fce117469ec5b2908df4f8732450b Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Wed, 8 Jun 2011 09:41:43 -0500 Subject: Test all lexers can be found by name or alias --- tests/test_basic_api.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/test_basic_api.py') diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py index 1e7dff14..3639bdbc 100644 --- a/tests/test_basic_api.py +++ b/tests/test_basic_api.py @@ -118,6 +118,12 @@ def test_get_lexers(): ]: yield verify, func, args + for cls, (_, lname, aliases, _, mimetypes) in lexers.LEXERS.iteritems(): + assert cls == lexers.find_lexer_class(lname).__name__ + + for alias in aliases: + assert cls == lexers.get_lexer_by_name(alias).__class__.__name__ + def test_formatter_public_api(): ts = list(lexers.PythonLexer().get_tokens("def f(): pass")) -- cgit v1.2.1 From 649d4541963d03f9e2ab06c97a68b1e1ea562923 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Wed, 8 Jun 2011 09:45:01 -0500 Subject: Test all lexers can be found by mime type --- tests/test_basic_api.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/test_basic_api.py') diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py index 3639bdbc..0ae2d1b3 100644 --- a/tests/test_basic_api.py +++ b/tests/test_basic_api.py @@ -124,6 +124,9 @@ def test_get_lexers(): for alias in aliases: assert cls == lexers.get_lexer_by_name(alias).__class__.__name__ + for mimetype in mimetypes: + assert cls == lexers.get_lexer_for_mimetype(mimetype).__class__.__name__ + def test_formatter_public_api(): ts = list(lexers.PythonLexer().get_tokens("def f(): pass")) -- cgit v1.2.1