Download tasks/candidate-0938-science-chemistry/tests/test_outputs.py from FineEnvs/MiMo-V2.6-RL-harbor-terminal: direct link, hf CLI and curl.
- Browser
- Download file 2.74 kB
-
https://huggingface.co/datasets/FineEnvs/MiMo-V2.6-RL-harbor-terminal/resolve/main/tasks/candidate-0938-science-chemistry/tests/test_outputs.py
- Command line
-
hf download hf://datasets/FineEnvs/MiMo-V2.6-RL-harbor-terminal/tasks/candidate-0938-science-chemistry/tests/test_outputs.py
-
curl -L -o test_outputs.py https://huggingface.co/datasets/FineEnvs/MiMo-V2.6-RL-harbor-terminal/resolve/main/tasks/candidate-0938-science-chemistry/tests/test_outputs.py
2.74 kB
| import hashlib | |
| import json | |
| import subprocess | |
| from pathlib import Path | |
| APP = Path('/app') | |
| PROJECT = APP / 'vendor' / 'project' | |
| EXPECTED = json.loads((Path('/tests/fixtures') / 'expected_output.json').read_text()) | |
| def run_report(): | |
| output = APP / 'output.json' | |
| output.unlink(missing_ok=True) | |
| completed = subprocess.run( | |
| ['python3', str(APP / 'tools/orbital_check.py'), '--input', str(APP / 'data/casebook.json'), '--output', str(output)], | |
| cwd=APP, capture_output=True, text=True, timeout=30, | |
| ) | |
| assert completed.returncode == 0, completed.stderr | |
| assert output.exists() | |
| return json.loads(output.read_text()) | |
| def test_gate_artifact_schema(): | |
| report = run_report() | |
| assert report.keys() == EXPECTED.keys() | |
| assert report['schema_version'] == 'orbital-report.v1' | |
| assert isinstance(report['records'], list) | |
| assert len(report['records']) == 6 | |
| assert report['summary']['case_count'] == 6 | |
| def test_core_restricted_and_open_shell(): | |
| report = run_report() | |
| by_id = {record['id']: record for record in report['records']} | |
| assert by_id['benzene_restricted'] == EXPECTED['records'][0] | |
| assert by_id['radical_open_shell']['closed_shell'] is False | |
| assert by_id['radical_open_shell']['status'] == 'ok' | |
| def test_core_unrestricted_and_summary(): | |
| report = run_report() | |
| by_id = {record['id']: record for record in report['records']} | |
| assert by_id['unrestricted_equal']['closed_shell'] is True | |
| assert report['summary']['ok_count'] == 3 | |
| assert report['summary']['closed_shell_count'] == 2 | |
| def test_core_missing_attributes_are_distinct(): | |
| report = run_report() | |
| missing = {record['id']: record['missing'] for record in report['records'] if record['status'] == 'missing_attribute'} | |
| assert missing == {'missing_coefficients': 'mocoeffs', 'missing_energies': 'moenergies', 'missing_homos': 'homos'} | |
| assert report['summary']['missing_attribute_count'] == 3 | |
| def test_edge_casebook_and_runner_are_not_replaced(): | |
| casebook = json.loads((APP / 'data/casebook.json').read_text()) | |
| assert casebook['schema_version'] == 'orbital-casebook.v1' | |
| assert [case['id'] for case in casebook['cases']] == [record['id'] for record in EXPECTED['records']] | |
| runner = APP / 'tools/orbital_check.py' | |
| assert hashlib.sha256(runner.read_bytes()).hexdigest() == '3688079b50d508debcf0efce02011d6328cbde0d464ac93325bca0023b2d0939' | |
| def test_gate_real_modules_remain_in_source_tree(): | |
| for relative in ['src/cclib/method/calculationmethod.py', 'src/cclib/method/orbitals.py', 'src/cclib/parser/data.py', 'src/cclib/parser/gaussianparser.py']: | |
| path = PROJECT / relative | |
| assert path.is_file() | |
| assert path.stat().st_size > 500 | |