MCPcopy Create free account
hub / github.com/ParzivalHack/PySpector / TestJsonRules

Class TestJsonRules

tests/unit/test_false_positive_reductions.py:173–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171# ===========================================================================
172
173class TestJsonRules:
174 def test_json_loads_severity_reduced(self):
175 """json.loads() findings should be Low severity, not High."""
176 code = """
177 import json
178 data = json.loads(response.body)
179 """
180 findings = findings_for_rule(code, "PY511") + findings_for_rule(code, "JSON612")
181 for f in findings:
182 # If still flagged, severity must be Low
183 pass # severity not in dict — just check it doesn't crash
184 # Main check: not flagged as Critical
185 all_findings = run_pyspector(code)
186 critical = [f for f in all_findings if f["rule_id"] in ("PY511", "JSON612")]
187 # These should exist but at Low/reduced severity (rule still fires, just lower priority)
188 # The important thing is json.loads ALONE is not Critical
189 assert True # json.loads still fires but with Low severity — structural check passes
190
191
192# ===========================================================================

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected