Drac0528 commited on
Commit
6cfcc6b
·
verified ·
1 Parent(s): e5acdbe

Delete tests

Browse files
tests/__pycache__/conftest.cpython-312-pytest-7.4.4.pyc DELETED
Binary file (726 Bytes)
 
tests/__pycache__/conftest.cpython-314-pytest-9.0.2.pyc DELETED
Binary file (739 Bytes)
 
tests/__pycache__/test_grader_and_env.cpython-312-pytest-7.4.4.pyc DELETED
Binary file (9.16 kB)
 
tests/__pycache__/test_grader_and_env.cpython-314-pytest-9.0.2.pyc DELETED
Binary file (10.6 kB)
 
tests/__pycache__/test_grader_and_env.cpython-314.pyc DELETED
Binary file (3.17 kB)
 
tests/conftest.py DELETED
@@ -1,10 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import sys
4
- from pathlib import Path
5
-
6
- # Make package importable when tests are run from the workspace root, e.g.:
7
- # python -m pytest -q OpenEnv/envs/code_security_auditor_env/tests/test_grader_and_env.py
8
- _ENVS_DIR = Path(__file__).resolve().parents[2]
9
- if str(_ENVS_DIR) not in sys.path:
10
- sys.path.insert(0, str(_ENVS_DIR))
 
 
 
 
 
 
 
 
 
 
 
tests/test_grader_and_env.py DELETED
@@ -1,63 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from code_security_auditor_env.models import CodeSecurityAction
4
- from code_security_auditor_env.server.grader import evaluate_finding
5
- from code_security_auditor_env.server.security_environment import CodeSecurityAuditorEnvironment
6
- from code_security_auditor_env.server.tasks import get_task
7
-
8
-
9
- def test_grader_deterministic_easy_match() -> None:
10
- task = get_task("easy")
11
- first = task.vulnerabilities[0]
12
-
13
- eval_a = evaluate_finding(
14
- task=task,
15
- filename=first.filename,
16
- vuln_type=first.vuln_type,
17
- severity=first.severity,
18
- line_start=first.line,
19
- line_end=first.line,
20
- confidence=0.8,
21
- matched_already=[],
22
- )
23
- eval_b = evaluate_finding(
24
- task=task,
25
- filename=first.filename,
26
- vuln_type=first.vuln_type,
27
- severity=first.severity,
28
- line_start=first.line,
29
- line_end=first.line,
30
- confidence=0.8,
31
- matched_already=[],
32
- )
33
-
34
- assert eval_a == eval_b
35
- assert eval_a.is_confirmed_match
36
- assert 0.0 <= eval_a.component_score <= 1.0
37
-
38
-
39
- def test_env_final_score_in_unit_interval() -> None:
40
- env = CodeSecurityAuditorEnvironment(default_task_id="easy")
41
- obs = env.reset(task_id="easy")
42
- assert obs.task_id == "easy"
43
-
44
- obs = env.step(CodeSecurityAction(action_type="inspect_file", filename="app/routes.py"))
45
- assert 0.0 <= float(obs.reward or 0.0) <= 1.0
46
-
47
- obs = env.step(
48
- CodeSecurityAction(
49
- action_type="submit_finding",
50
- filename="app/routes.py",
51
- line_start=8,
52
- vuln_type="sql_injection",
53
- severity="high",
54
- confidence=0.85,
55
- evidence="user id interpolated in SQL",
56
- summary="SQL injection in get_user",
57
- )
58
- )
59
- assert 0.0 <= float(obs.reward or 0.0) <= 1.0
60
-
61
- obs = env.step(CodeSecurityAction(action_type="submit_final_report"))
62
- assert obs.done is True
63
- assert 0.0 <= float(obs.reward or 0.0) <= 1.0