Python: Rewrite inline expectation tests to use parameterized module

This commit is contained in:
Jeroen Ketema
2023-06-07 13:37:23 +02:00
parent 49993b023e
commit 8f599faf85
28 changed files with 105 additions and 84 deletions

View File

@@ -4,17 +4,15 @@ import TestUtilities.InlineExpectationsTest
import semmle.python.functions.ModificationOfParameterWithDefault
private import semmle.python.dataflow.new.internal.PrintNode
class ModificationOfParameterWithDefaultTest extends InlineExpectationsTest {
ModificationOfParameterWithDefaultTest() { this = "ModificationOfParameterWithDefaultTest" }
module ModificationOfParameterWithDefaultTest implements TestSig {
string getARelevantTag() { result = "modification" }
override string getARelevantTag() { result = "modification" }
predicate relevant_node(DataFlow::Node sink) {
private predicate relevant_node(DataFlow::Node sink) {
exists(ModificationOfParameterWithDefault::Configuration cfg | cfg.hasFlowTo(sink))
}
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(DataFlow::Node n | this.relevant_node(n) |
predicate hasActualResult(Location location, string element, string tag, string value) {
exists(DataFlow::Node n | relevant_node(n) |
n.getLocation() = location and
tag = "modification" and
value = prettyNode(n) and
@@ -22,3 +20,5 @@ class ModificationOfParameterWithDefaultTest extends InlineExpectationsTest {
)
}
}
import MakeTest<ModificationOfParameterWithDefaultTest>