Skip to content

Commit

Permalink
add test case (to check ISSUE 23)
Browse files Browse the repository at this point in the history
  • Loading branch information
dedece35 committed Oct 4, 2024
1 parent cd429e4 commit 66c98ea
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
public class AvoidGlobalVariableInFunctionCheckTest {
@Test
public void test() {
PythonCheckVerifier.verify("src/test/resources/checks/avoidGlobalVariableInFunction.py", new AvoidGlobalVariableInFunctionCheck());
PythonCheckVerifier.verify("src/test/resources/checks/avoidGlobalVariableInFunctionNonCompliant.py", new AvoidGlobalVariableInFunctionCheck());
//PythonCheckVerifier.verifyNoIssue("src/test/resources/checks/avoidGlobalVariableInFunctionCompliant.py", new AvoidGlobalVariableInFunctionCheck());
PythonCheckVerifier.verify("src/test/resources/checks/avoidGlobalVariableInFunctionNonCompliant2.py", new AvoidGlobalVariableInFunctionCheck());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# example from official Python documentation

from collections.abc import Sequence
from typing import TypeVar

U = TypeVar('U') # Declare type variable "U"

def second(l: Sequence[U]) -> U: # Function is generic over the TypeVar "U"
print(U) #Noncompliant
return l[1]

0 comments on commit 66c98ea

Please sign in to comment.