Download code/test_export.py from ChengyiX/coder390-fable-m4max-agent-study: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/datasets/ChengyiX/coder390-fable-m4max-agent-study/resolve/main/code/test_export.py
- Command line
-
hf download hf://datasets/ChengyiX/coder390-fable-m4max-agent-study/code/test_export.py
-
curl -L -o test_export.py https://huggingface.co/datasets/ChengyiX/coder390-fable-m4max-agent-study/resolve/main/code/test_export.py
1.4 kB
| import importlib.util | |
| import json | |
| import unittest | |
| from pathlib import Path | |
| class ExportTests(unittest.TestCase): | |
| def module(self): | |
| self.assertIsNotNone(importlib.util.find_spec('export_results')) | |
| import export_results | |
| return export_results | |
| def test_whitelist_excludes_private_source_and_paths(self): | |
| src={'run_id':'fixture','completed':False,'elapsed_s':900,'errors':[{'error':'PRIVATE SOURCE /Users/person SECRET'}],'workspace':'SECRET','initial_input_tokens':25000,'visible_stream_tps':None} | |
| row=self.module().public_run(src) | |
| self.assertNotIn('SECRET',json.dumps(row));self.assertNotIn('/Users',json.dumps(row)) | |
| self.assertFalse(row['completed']);self.assertIsNone(row['visible_stream_tps']) | |
| self.assertEqual(row['initial_input_tokens'],25000) | |
| def test_invalid_metric_or_identifier_rejected(self): | |
| m=self.module() | |
| for value in ['SECRET',float('nan'),True]: | |
| with self.assertRaises(ValueError):m.public_run({'run_id':'fixture','elapsed_s':value}) | |
| with self.assertRaises(ValueError):m.public_run({'run_id':'/private/path'}) | |
| def test_success_not_inferred_from_tests_only(self): | |
| r=self.module().public_run({'run_id':'fixture','completed':False,'gate_pass':True,'full_suite_pass':True}) | |
| self.assertFalse(r['completed']);self.assertIsNone(r['visible_stream_tps']) | |