Skip to content

Commit

Permalink
SONARPY-2323 Add unit test case on S5655 when called function is impo…
Browse files Browse the repository at this point in the history
…rted (#2149)
  • Loading branch information
maksim-grebeniuk-sonarsource authored Nov 12, 2024
1 parent bf4e354 commit 4da8b75
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package org.sonar.python.checks;

import java.util.List;
import org.junit.jupiter.api.Test;
import org.sonar.python.checks.utils.PythonCheckVerifier;

Expand All @@ -33,4 +34,15 @@ void test() {
void test_overloaded_functions() {
PythonCheckVerifier.verify("src/test/resources/checks/argumentType_overloaded_functions.py", new ArgumentTypeCheck());
}

@Test
void importedTypesTest() {
PythonCheckVerifier.verify(
List.of(
"src/test/resources/checks/argumentTypeImporting.py",
"src/test/resources/checks/argumentTypeImported.py"
),
new ArgumentTypeCheck()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
def imported_function(params: list[str]): ...
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from argumentTypeImported import imported_function

def local_function(params: list[str]): ...

def imported_fn():
imported_function(("Name", "Tags")) # FN SONARPY-2325
local_function(("Name", "Tags")) # Noncompliant

0 comments on commit 4da8b75

Please sign in to comment.