Spaces:
Sleeping
Sleeping
Commit ·
4336fc9
1
Parent(s): 3c855d7
This is the second End
Browse files- _pytest_results.txt +0 -0
- _revert_tests.py +30 -0
- _tail.txt +0 -0
_pytest_results.txt
ADDED
|
Binary file (21 kB). View file
|
|
|
_revert_tests.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import re
|
| 2 |
+
|
| 3 |
+
with open('tests/test_inference.py', 'r') as f:
|
| 4 |
+
code = f.read()
|
| 5 |
+
|
| 6 |
+
# block 1
|
| 7 |
+
code = re.sub(
|
| 8 |
+
r'for line in stdout.split\(\"\\n\"\):\n\s+if \'\"type\": \"START\"\' in line:\n\s+try:\n\s+import json\n\s+d = json\.loads\(line\)\n\s+tasks_run\.append\(d\.get\(\"task\"\)\)\n\s+except:\n\s+pass',
|
| 9 |
+
r'for line in stdout.split("\n"):\n if line.startswith("[START]"):\n match = re.match(r"\[START\] task=(\S+) env=(\S+) model=(\S+)", line)\n assert match\n tasks_run.append(match.group(1))',
|
| 10 |
+
code
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
# block 2
|
| 14 |
+
code = re.sub(
|
| 15 |
+
r'for line in stdout\.split\(\"\\n\"\):\n\s+if \'\"type\": \"START\"\' in line:\n\s+import json\n\s+d = json\.loads\(line\)\n\s+assert d\.get\(\"task\"\) in self\.TASK_IDS\n\s+assert d\.get\(\"env\"\) == \"citywide-dispatch-supervisor\"\n\s+assert d\.get\(\"model\"\) == \"test-model\"',
|
| 16 |
+
r'pattern = r"\[START\] task=\S+ env=citywide-dispatch-supervisor model=\S+"\n for line in stdout.split("\n"):\n if line.startswith("[START]"):\n assert re.match(pattern, line)',
|
| 17 |
+
code
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
# block 3
|
| 21 |
+
code = re.sub(
|
| 22 |
+
r'valid_errors = \{None, \"max_steps_exceeded\", \"illegal_transition\", \"step_error\"\}\n\s+for line in stdout\.split\(\"\\n\"\):\n\s+if \'\"type\": \"STEP\"\' in line:\n\s+import json\n\s+d = json\.loads\(line\)\n\s+assert d\.get\(\"error\"\) in valid_errors or isinstance\(d\.get\(\"error\"\), str\)',
|
| 23 |
+
r'valid_errors = {"null", "max_steps_exceeded", "illegal_transition", "step_error"}\n for line in stdout.split("\n"):\n if not line.startswith("[STEP]"):\n continue\n match = re.match(r"\[STEP\].+ error=(.+)", line)\n assert match\n assert match.group(1) in valid_errors',
|
| 24 |
+
code
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
with open('tests/test_inference.py', 'w') as f:
|
| 28 |
+
f.write(code)
|
| 29 |
+
|
| 30 |
+
print('tests done reverting')
|
_tail.txt
ADDED
|
Binary file (2.04 kB). View file
|
|
|