コード例 #1
0
 def test_simulate(self):
     '''Verify a single simulation run returns 0 or more failures per resistance reading'''
     sim_result = sensornetwork.simulate(num_cycles=3*self.mean_time_to_failure,
         part_configurations=self.part_configs)
     for key, failures_str in sim_result.items():
         # Ensure float() doesn't raise ValueError in converting key
         float(key)
         if failures_str != '':
             failures = failures_str.split(',')
             self.assertTrue(len(failures)>0)
コード例 #2
0
 def test_simulate_returns_dict(self):
     '''Verify a single run of a simulation returns a dict of resistance, failures'''
     sim_result = sensornetwork.simulate(num_cycles=3*self.mean_time_to_failure,
         part_configurations = self.part_configs)
     self.assertIsInstance(sim_result, dict)