fix(tests): use exact-equality check to clear CodeQL substring-URL false positive (#1183)

CodeQL (py/incomplete-url-substring-sanitization) flagged the "https://schema.org/"
in flattened check because it pattern-matches on URL-ish strings tested with `in`.
flattened is always a list here, so the check was already exact membership, not a
substring test on untrusted input, but the ambiguous idiom tripped the scanner.
Rewrite as an explicit equality comparison so the intent is unambiguous.
This commit is contained in:
Mohd Kaif
2026-08-22 15:12:52 +05:30
committed by GitHub
parent 14091d21fb
commit 483f53aaa6
+1 -1
View File
@@ -160,7 +160,7 @@ def test_a_url_valued_context_is_not_thrown_away(tmp_path):
context = json.loads(path.read_text())["@context"]
flattened = context if isinstance(context, list) else [context]
assert "https://schema.org/" in flattened, (
assert any(entry == "https://schema.org/" for entry in flattened), (
"the caller's context was replaced by Semantica's defaults, "
"which silently changes how every term expands"
)