25
25
26
26
import static org .assertj .core .api .Assertions .assertThat ;
27
27
import static org .sonar .plugins .python .api .PythonVersionUtils .Version .V_27 ;
28
+ import static org .sonar .plugins .python .api .PythonVersionUtils .Version .V_310 ;
28
29
import static org .sonar .plugins .python .api .PythonVersionUtils .Version .V_35 ;
29
30
import static org .sonar .plugins .python .api .PythonVersionUtils .Version .V_36 ;
30
31
import static org .sonar .plugins .python .api .PythonVersionUtils .Version .V_37 ;
@@ -38,13 +39,14 @@ public class PythonVersionUtilsTest {
38
39
39
40
@ Test
40
41
public void supportedVersions () {
41
- assertThat (PythonVersionUtils .fromString ("" )).containsExactlyInAnyOrder (V_27 , V_35 , V_36 , V_37 , V_38 , V_39 );
42
- assertThat (PythonVersionUtils .fromString ("," )).containsExactlyInAnyOrder (V_27 , V_35 , V_36 , V_37 , V_38 , V_39 );
42
+ assertThat (PythonVersionUtils .fromString ("" )).containsExactlyInAnyOrder (V_27 , V_35 , V_36 , V_37 , V_38 , V_39 , V_310 );
43
+ assertThat (PythonVersionUtils .fromString ("," )).containsExactlyInAnyOrder (V_27 , V_35 , V_36 , V_37 , V_38 , V_39 , V_310 );
43
44
assertThat (PythonVersionUtils .fromString ("2.7" )).containsExactlyInAnyOrder (V_27 );
44
45
assertThat (PythonVersionUtils .fromString ("2" )).containsExactlyInAnyOrder (V_27 );
45
46
assertThat (PythonVersionUtils .fromString ("3" )).containsExactlyInAnyOrder (V_35 );
46
47
assertThat (PythonVersionUtils .fromString ("3.8, 3.9" )).containsExactlyInAnyOrder (V_38 , V_39 );
47
48
assertThat (PythonVersionUtils .fromString ("2.7, 3.9" )).containsExactlyInAnyOrder (V_27 , V_39 );
49
+ assertThat (PythonVersionUtils .fromString ("3.10" )).containsExactlyInAnyOrder (V_310 );
48
50
}
49
51
50
52
@ Test
@@ -55,9 +57,9 @@ public void version_out_of_range() {
55
57
56
58
@ Test
57
59
public void error_while_parsing_version () {
58
- assertThat (PythonVersionUtils .fromString ("foo" )).containsExactlyInAnyOrder (V_27 , V_35 , V_36 , V_37 , V_38 , V_39 );
59
- assertThat (PythonVersionUtils .fromString ("3.8.1" )).containsExactlyInAnyOrder (V_27 , V_35 , V_36 , V_37 , V_38 , V_39 );
60
- assertThat (PythonVersionUtils .fromString ("3.81" )).containsExactlyInAnyOrder (V_27 , V_35 , V_36 , V_37 , V_38 , V_39 );
60
+ assertThat (PythonVersionUtils .fromString ("foo" )).containsExactlyInAnyOrder (V_27 , V_35 , V_36 , V_37 , V_38 , V_39 , V_310 );
61
+ assertThat (PythonVersionUtils .fromString ("3.8.1" )).containsExactlyInAnyOrder (V_27 , V_35 , V_36 , V_37 , V_38 , V_39 , V_310 );
62
+ assertThat (PythonVersionUtils .fromString ("3.81" )).containsExactlyInAnyOrder (V_27 , V_35 , V_36 , V_37 , V_38 , V_39 , V_310 );
61
63
assertThat (logTester .logs (LoggerLevel .WARN )).contains ("Error while parsing value of parameter 'sonar.python.version' (foo). Versions must be specified as MAJOR_VERSION.MIN.VERSION (e.g. \" 3.7, 3.8\" )" );
62
64
}
63
65
}
0 commit comments