Freeze independent DTW speech timing diagnostic and startup provenance
This commit is contained in:
1 parent
705500425a
commit
3ac1201909
9 files changed
+250
-27
No files matched your search
@@ -6,11 +6,24 @@ import tempfile
|
||||
import sys
|
||||
import os
|
||||
import wave
|
||||
import importlib.util
|
||||
import hashlib
|
||||
from run import segments, run_owned, recognized_window, decode_command, decoded_frames, primary_audio_range
|
||||
from score import score, require_eligible
|
||||
|
||||
|
||||
class ContractTests(unittest.TestCase):
|
||||
def test_harness_source_hash_is_captured_before_file_changes(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
path = Path(directory) / "run-copy.py"
|
||||
original = Path(__file__).with_name("run.py").read_bytes()
|
||||
path.write_bytes(original)
|
||||
spec = importlib.util.spec_from_file_location("speech_start_hash_test", path)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
path.write_bytes(original + b"\n# changed after startup\n")
|
||||
self.assertEqual(module.HARNESS_SHA256_AT_START, hashlib.sha256(original).hexdigest())
|
||||
self.assertNotEqual(module.HARNESS_SHA256_AT_START, module.sha256(path))
|
||||
def test_scoring_rejects_incomplete_or_reduced_pool(self):
|
||||
for report in [{}, {"complete": False, "quality_score_eligible": True},
|
||||
{"complete": True, "quality_score_eligible": False},
|
||||
|
||||
Reference in new issue
Block a user