Coverage for commands\test_checkerCommands.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# -*- coding: utf-8 -*-
2#@+leo-ver=5-thin
3#@+node:ekr.20210904022712.2: * @file ../unittests/commands/test_checkerCommands.py
4#@@first
5"""Tests of leo.commands.leoCheckerCommands."""
6import re
7from leo.core.leoTest2 import LeoUnitTest
8import leo.commands.checkerCommands as checkerCommands
9#@+others
10#@+node:ekr.20210904022712.3: ** class TestChecker(LeoUnitTest):
11class TestChecker(LeoUnitTest):
12 """Test cases for leoCheckerCommands.py"""
13 #@+others
14 #@+node:ekr.20210904031436.1: *3* test_regex_for_pylint
15 def test_regex_for_pylint(self):
16 c = self.c
17 x = checkerCommands.PylintCommand(c)
18 pattern = re.compile(x.link_pattern)
19 table = (
20 r'c:\test\pylint_links_test2.py:5:4: R1705: Unnecessary "else" after "return" (no-else-return)',
21 r'c:\test\pylint_links_test.py:6:3: C1801: Do not use `len(SEQUENCE)` to determine if a sequence is empty (len-as-condition)', # pylint: disable=line-too-long
22 # A particularly good test, because it has two parenthesized expressions.
23 )
24 for message in table:
25 # Windows style file names.
26 m = pattern.match(message)
27 assert m, message
28 # Linux style file names.
29 message = message.replace('\\', '/')
30 m = pattern.match(message)
31 self.assertTrue(m, msg=message)
32 #@-others
33#@-others
36#@-leo