test: severity_from_level

pull/442/head
QuentinN42 3 years ago
parent b1ce2f290b
commit 32de447205
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="1644491832865" lines-valid="3579" lines-covered="3497" line-rate="0.9771" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0">
<coverage version="6.3.1" timestamp="1644492016536" lines-valid="3584" lines-covered="3505" line-rate="0.978" 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>
@ -606,6 +606,11 @@
<line number="22" hits="1"/>
<line number="23" hits="1"/>
<line number="24" hits="1"/>
<line number="27" hits="1"/>
<line number="29" hits="1"/>
<line number="38" hits="1"/>
<line number="39" hits="1"/>
<line number="40" hits="1"/>
</lines>
</class>
<class name="test_linter.py" filename="tests/test_linter.py" complexity="0" line-rate="1" branch-rate="0">
@ -2449,7 +2454,7 @@
</class>
</classes>
</package>
<package name="yamllint" line-rate="0.8909" branch-rate="0" complexity="0">
<package name="yamllint" line-rate="0.8955" branch-rate="0" complexity="0">
<classes>
<class name="__init__.py" filename="yamllint/__init__.py" complexity="0" line-rate="1" branch-rate="0">
<methods/>
@ -2670,7 +2675,7 @@
<line number="213" hits="1"/>
</lines>
</class>
<class name="format.py" filename="yamllint/format.py" complexity="0" line-rate="0.7642" branch-rate="0">
<class name="format.py" filename="yamllint/format.py" complexity="0" line-rate="0.7783" branch-rate="0">
<methods/>
<lines>
<line number="2" hits="1"/>
@ -2694,9 +2699,9 @@
<line number="40" hits="1"/>
<line number="41" hits="1"/>
<line number="44" hits="1"/>
<line number="45" hits="0"/>
<line number="46" hits="0"/>
<line number="47" hits="0"/>
<line number="45" hits="1"/>
<line number="46" hits="1"/>
<line number="47" hits="1"/>
<line number="50" hits="1"/>
<line number="53" hits="1"/>
<line number="55" hits="1"/>

@ -22,3 +22,19 @@ class TextToXMLTestCase(unittest.TestCase):
def test_specials_chars(self):
for inp, out in self.specials.items():
self.assertEqual(escape_xml(inp), out)
class CodeClimateSeverityTestCase(unittest.TestCase):
expected = {
None: "info",
'warning': "minor",
'error': "major",
0: "info",
1: "minor",
2: "major",
}
def test_specials_chars(self):
for inp, out in self.expected.items():
self.assertEqual(severity_from_level(inp), out)

Loading…
Cancel
Save