1+ from __future__ import annotations
2+
13import unittest
24
35import convert_to_sarif
46
57
68class TestConvertToSarif (unittest .TestCase ):
7- def test_produce_sarif_returns_correct_sarif_result (self ):
9+ def test_produce_sarif_returns_correct_sarif_result (self ) -> None :
810 lintrunner_results = [
911 {
1012 "path" : "test.py" ,
@@ -47,9 +49,7 @@ def test_produce_sarif_returns_correct_sarif_result(self):
4749 {
4850 "id" : "FLAKE8/test-code" ,
4951 "name" : "FLAKE8/test-code" ,
50- "shortDescription" : {
51- "text" : "FLAKE8/test-code: test description"
52- },
52+ "shortDescription" : {"text" : "FLAKE8/test-code" },
5353 "fullDescription" : {
5454 "text" : "FLAKE8/test-code\n test description"
5555 },
@@ -58,9 +58,7 @@ def test_produce_sarif_returns_correct_sarif_result(self):
5858 {
5959 "id" : "FLAKE8/test-code-2" ,
6060 "name" : "FLAKE8/test-code-2" ,
61- "shortDescription" : {
62- "text" : "FLAKE8/test-code-2: test description"
63- },
61+ "shortDescription" : {"text" : "FLAKE8/test-code-2" },
6462 "fullDescription" : {
6563 "text" : "FLAKE8/test-code-2\n test description"
6664 },
@@ -73,7 +71,7 @@ def test_produce_sarif_returns_correct_sarif_result(self):
7371 {
7472 "ruleId" : "FLAKE8/test-code" ,
7573 "level" : "error" ,
76- "message" : {"text" : "FLAKE8/ test-code \n test description" },
74+ "message" : {"text" : "test description" },
7775 "locations" : [
7876 {
7977 "physicalLocation" : {
@@ -86,7 +84,7 @@ def test_produce_sarif_returns_correct_sarif_result(self):
8684 {
8785 "ruleId" : "FLAKE8/test-code-2" ,
8886 "level" : "error" ,
89- "message" : {"text" : "FLAKE8/ test-code-2 \n test description" },
87+ "message" : {"text" : "test description" },
9088 "locations" : [
9189 {
9290 "physicalLocation" : {
@@ -99,7 +97,7 @@ def test_produce_sarif_returns_correct_sarif_result(self):
9997 {
10098 "ruleId" : "FLAKE8/test-code" ,
10199 "level" : "note" ,
102- "message" : {"text" : "FLAKE8/ test-code \n test description" },
100+ "message" : {"text" : "test description" },
103101 "locations" : [
104102 {
105103 "physicalLocation" : {
@@ -116,7 +114,7 @@ def test_produce_sarif_returns_correct_sarif_result(self):
116114 self .maxDiff = None
117115 self .assertEqual (actual , expected )
118116
119- def test_it_handles_relative_paths (self ):
117+ def test_it_handles_relative_paths (self ) -> None :
120118 lintrunner_results = [
121119 {
122120 "path" : "test.py" ,
@@ -133,7 +131,7 @@ def test_it_handles_relative_paths(self):
133131 {
134132 "ruleId" : "FLAKE8/test-code" ,
135133 "level" : "error" ,
136- "message" : {"text" : "FLAKE8/ test-code \n test description" },
134+ "message" : {"text" : "test description" },
137135 "locations" : [
138136 {
139137 "physicalLocation" : {
@@ -146,7 +144,7 @@ def test_it_handles_relative_paths(self):
146144 ]
147145 self .assertEqual (actual ["runs" ][0 ]["results" ], expected_results )
148146
149- def test_it_handles_absolute_paths (self ):
147+ def test_it_handles_absolute_paths (self ) -> None :
150148 lintrunner_results = [
151149 {
152150 "path" : "/path/to/test.py" ,
@@ -163,7 +161,7 @@ def test_it_handles_absolute_paths(self):
163161 {
164162 "ruleId" : "FLAKE8/test-code" ,
165163 "level" : "error" ,
166- "message" : {"text" : "FLAKE8/ test-code \n test description" },
164+ "message" : {"text" : "test description" },
167165 "locations" : [
168166 {
169167 "physicalLocation" : {
0 commit comments