test: Class to test all fmt

pull/442/head
QuentinN42 3 years ago
parent eb48e1d908
commit 1f6adf64f8
No known key found for this signature in database
GPG Key ID: 2CD7D563712B3A50

@ -1,5 +1,5 @@
<?xml version="1.0" ?>
<coverage version="6.3.1" timestamp="1644493279412" lines-valid="3607" lines-covered="3532" line-rate="0.9792" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0">
<coverage version="6.3.1" timestamp="1644493525824" lines-valid="3611" lines-covered="3536" line-rate="0.9792" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0">
<!-- Generated by coverage.py: https://coverage.readthedocs.io -->
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
<sources>
@ -634,6 +634,10 @@
<line number="92" hits="1"/>
<line number="93" hits="1"/>
<line number="96" hits="1"/>
<line number="98" hits="1"/>
<line number="102" hits="1"/>
<line number="103" hits="1"/>
<line number="104" hits="1"/>
</lines>
</class>
<class name="test_linter.py" filename="tests/test_linter.py" complexity="0" line-rate="1" branch-rate="0">

@ -16,9 +16,6 @@ from yamllint.format import (
)
INPUT = []
class TextToXMLTestCase(unittest.TestCase):
specials = {
@ -91,3 +88,17 @@ class FormaterTestCase(unittest.TestCase):
inst.show_problems_for_file([], "a")
with self.assertRaises(NotImplementedError):
inst.show_problem(None, "a")
class FormatersTestCase(unittest.TestCase):
args = [
(ParsableFormater(True), {"file1.yml": []}, ""),
]
def test_all_formaters(self):
for inst, inp, ret in self.args:
self.assertEqual(
inst.show_problems_for_all_files(inp),
ret
)

@ -381,7 +381,11 @@ class CodeclimateFormater(Formater):
def max_level(all_problems):
"""Return the max level of all problems."""
all_levels = [problem.level for problems in all_problems.values() for problem in problems]
all_levels = [
problem.level
for problems in all_problems.values()
for problem in problems
]
if all_levels:
return max(map(lambda x: PROBLEM_LEVELS[x], all_levels))
return 0

Loading…
Cancel
Save