MCPcopy
hub / github.com/hyperopt/hyperopt / test_valid

Method test_valid

hyperopt/tests/test_base.py:140–164  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

138 self.trials = Trials()
139
140 def test_valid(self):
141 trials = self.trials
142 f = trials.insert_trial_doc
143 fine = ok_trial("ID", 1, 2, 3)
144
145 # --original runs fine
146 f(fine)
147
148 # -- take out each mandatory root key
149 def knockout(key):
150 rval = copy.deepcopy(fine)
151 del rval[key]
152 return rval
153
154 for key in TRIAL_KEYS:
155 self.assertRaises(InvalidTrial, f, knockout(key))
156
157 # -- take out each mandatory misc key
158 def knockout2(key):
159 rval = copy.deepcopy(fine)
160 del rval["misc"][key]
161 return rval
162
163 for key in TRIAL_MISC_KEYS:
164 self.assertRaises(InvalidTrial, f, knockout2(key))
165
166 def test_insert_sync(self):
167 trials = self.trials

Callers

nothing calls this directly

Calls 1

ok_trialFunction · 0.85

Tested by

no test coverage detected