Datasets:
Download scripts/test_batch04_runtime_resource.py from CrossSWE/CrossSWE-Bench: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/datasets/CrossSWE/CrossSWE-Bench/resolve/main/scripts/test_batch04_runtime_resource.py
- Command line
-
hf download hf://datasets/CrossSWE/CrossSWE-Bench/scripts/test_batch04_runtime_resource.py
-
curl -L -o test_batch04_runtime_resource.py https://huggingface.co/datasets/CrossSWE/CrossSWE-Bench/resolve/main/scripts/test_batch04_runtime_resource.py
1.18 kB
| import copy,importlib.util,sys,unittest | |
| from pathlib import Path | |
| ROOT=Path(__file__).parent | |
| sys.path.insert(0,str(ROOT/'reusable_support')) | |
| # In the released repository this test is beside the portable entrypoint. | |
| import evaluate_reusable_batch04_image as entry | |
| class RuntimeDescriptor(unittest.TestCase): | |
| def descriptor(self): | |
| return {'kind':'browser-infrastructure','image_ref':'example/runtime@sha256:'+'1'*64,'container_path':'/crossswe-evaluator/browser-infra','source_manifest_sha256':'2'*64,'files':[{'path':n,'bytes':1,'sha256':'2'*64} for n in ['manifest.json','source-manifest.json']]} | |
| def test_closed_descriptor(self):entry.validate_runtime_descriptor(self.descriptor()) | |
| def test_duplicate_or_escaping_paths_rejected(self): | |
| for path in ['../outside','/absolute','manifest.json']: | |
| d=self.descriptor();d['files'].append({'path':path,'bytes':1,'sha256':'2'*64}) | |
| with self.assertRaises(AssertionError):entry.validate_runtime_descriptor(d) | |
| def test_manifest_binding_rejected(self): | |
| d=self.descriptor();d['source_manifest_sha256']='3'*64 | |
| with self.assertRaises(AssertionError):entry.validate_runtime_descriptor(d) | |
| if __name__=='__main__':unittest.main() | |