zefancainlp's picture
download
raw
1.84 kB
"""Check the real Environment.step extractor call site in the isolated runtime."""
from ttt_discover.tinker_utils.dataset_builder import last_codeblock_postprocess
from ttt_discover.runtime.train import environment_for
from ttt_discover.runtime.launch import resolve
def test_native_callsite_uses_final_answer_instead_of_analysis():
response = ('<|channel|>analysis<|message|>```python\nwrong = 1\n```\n'
'<|channel|>final<|message|>def custom_kernel(data):\n return data')
code = last_codeblock_postprocess(response,codeblock_seps=['python'],keep_separators=False)
assert code == 'def custom_kernel(data):\n return data'
def test_native_callsite_does_not_salvage_earlier_analysis():
response = ('<|channel|>analysis<|message|>```python\nwrong = 1\n```\n'
'<|channel|>final<|message|>No complete transaction.')
assert last_codeblock_postprocess(response,codeblock_seps=['python'],keep_separators=False) == ''
def test_native_spec_locks_the_extractor(tmp_path):
# Reuse the existing runtime-dispatch fixture, with no GPU or API calls.
import importlib.util
from pathlib import Path
fixture=Path('/mnt/localssd/xiaofan/kernel-private-entry-api3-20261028/source/tests/test_kernel_private_entry_env.py')
spec=importlib.util.spec_from_file_location('original_native_test_fixture',fixture)
mod=importlib.util.module_from_spec(spec);spec.loader.exec_module(mod)
config=resolve(mod.options(tmp_path))
assert len(config['kernel_private_entry_spec']['extractor_sha256']) == 64
assert len(config['kernel_private_entry_spec']['extractor_callsite_sha256']) == 64
config['kernel_private_entry_spec']['extractor_sha256']='changed'
import pytest
with pytest.raises(ValueError,match='resolved configuration'):
environment_for(config)

Xet Storage Details

Size:
1.84 kB
·
Xet hash:
39d8ced82f4c3f0094e0043c5dcd24bcfe803df25be1bb275a54852ef3d94837

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.