ChengyiX's picture
Publish KLIK real-agent Coder390 and TURBO-Fable replacement study with all failures
dbbcf1a verified
Raw History Blame Contribute Delete
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'])