def testSensorSpec1(self): """ Making sure that the sensor spec survives the pickling """ raytracer = TexturedRaytracer() raytracer.set_map(example_world) raytracer.set_sensor(example_sensor) data1 = raytracer.query_sensor([0, 0], 0) raytracer2 = make_sure_pickable(raytracer) data2 = raytracer2.query_sensor([0, 0], 0) self.assertEqual(data1['readings'], data2['readings'])
def testMapIsReset(self): """ Making sure that the map is overwritten """ raytracer = TexturedRaytracer() raytracer.set_sensor(example_sensor) raytracer.set_map(empty_world) data1 = raytracer.query_sensor([0, 0], 0) readings = array(data1['readings'], dtype='float32') self.assertTrue(isnan(readings).all()) raytracer.set_map(example_world) data1 = raytracer.query_sensor([0, 0], 0) readings = array(data1['readings'], dtype='float32') self.assertTrue(not isnan(readings).any()) raytracer.set_map(empty_world) data1 = raytracer.query_sensor([0, 0], 0) readings = array(data1['readings'], dtype='float32') self.assertTrue(isnan(readings).all())