Coverage for commands\test_checkerCommands.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v6.4, created at 2022-05-24 10:21 -0500

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.""" 

6from leo.core import leoGlobals as g 

7from leo.core.leoTest2 import LeoUnitTest 

8#@+others 

9#@+node:ekr.20210904022712.3: ** class TestChecker(LeoUnitTest): 

10class TestChecker(LeoUnitTest): 

11 """Test cases for leoCheckerCommands.py""" 

12 #@+others 

13 #@+node:ekr.20210904031436.1: *3* test_regex_for_pylint 

14 def test_regex_for_pylint(self): 

15 c = self.c 

16 pattern = g.pylint_pat 

17 table = ( 

18 r'c:\test\pylint_links_test2.py:5:4: R1705: Unnecessary "else" after "return" (no-else-return)', 

19 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 

20 # A particularly good test, because it has two parenthesized expressions. 

21 ) 

22 for message in table: 

23 # Windows style file names. 

24 m = pattern.match(message) 

25 assert m, message 

26 # Linux style file names. 

27 message = message.replace('\\', '/') 

28 m = pattern.match(message) 

29 self.assertTrue(m, msg=message) 

30 #@-others 

31#@-others 

32 

33 

34#@-leo