Archived
Implement bounded S2 preparation and sealed pilot execution
This commit is contained in:
1 parent
fb827178ec
commit
f8a6ed3f81
35 files changed
+2626
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
import numpy as np
|
||||
import torch
|
||||
from run_s2_pilot_training import LearningBases,load_part
|
||||
|
||||
|
||||
class PilotEntrySealTests(unittest.TestCase):
|
||||
def setUp(self):self.roles=dict(learning_parts=['a'],validation_parts=['b'],sealed_test_parts=['c'])
|
||||
def test_normalizer_mapping_rejects_validation_and_test_before_io(self):
|
||||
for case in ['b','c']:
|
||||
bases=LearningBases({case:dict(preparation_root='never-open')},[case],self.roles)
|
||||
with patch('run_s2_pilot_training.np.load') as loader:
|
||||
with self.assertRaises(PermissionError):bases[case]
|
||||
loader.assert_not_called()
|
||||
def test_training_loader_rejects_sealed_test_before_hash_or_arrays(self):
|
||||
with patch('run_s2_pilot_training.sha') as hasher,patch('run_s2_pilot_training.np.load') as loader:
|
||||
with self.assertRaises(PermissionError):load_part(dict(case='c'),self.roles,torch.device('cpu'))
|
||||
hasher.assert_not_called();loader.assert_not_called()
|
||||
|
||||
|
||||
if __name__=='__main__':unittest.main(verbosity=2)
|
||||
Reference in new issue
Block a user