def test_assert_images_close(self): image1 = np.random.randint(0, 255, size=(64, 64, 3), dtype=np.uint8) image2 = np.random.randint(0, 255, size=(64, 64, 3), dtype=np.uint8) image_utils.assert_images_close(image1, image1, tolerance=0) with self.assertRaisesRegexp(image_utils.ImagesNotClose, 'RMS error exceeds tolerance'): image_utils.assert_images_close(image1, image2)
def test_assert_images_close(self): random_state = np.random.RandomState(SEED) image1 = random_state.randint(0, 255, size=(64, 64, 3), dtype=np.uint8) image2 = random_state.randint(0, 255, size=(64, 64, 3), dtype=np.uint8) image_utils.assert_images_close(image1, image1, tolerance=0) with self.assertRaisesRegex( # pylint: disable=g-error-prone-assert-raises image_utils.ImagesNotCloseError, 'RMS error exceeds tolerance'): image_utils.assert_images_close(image1, image2)
def test_assert_images_close(self): random_state = np.random.RandomState(SEED) image1 = random_state.randint(0, 255, size=(64, 64, 3), dtype=np.uint8) image2 = random_state.randint(0, 255, size=(64, 64, 3), dtype=np.uint8) image_utils.assert_images_close(image1, image1, tolerance=0) with six.assertRaisesRegex(self, image_utils.ImagesNotClose, 'RMS error exceeds tolerance'): image_utils.assert_images_close(image1, image2)
def test_render_multiple_physics_per_thread(self): cartpole = image_utils.cartpole humanoid = image_utils.humanoid cartpole_frames = [] humanoid_frames = [] for cartpole_frame, humanoid_frame in zip(cartpole.iter_render(), humanoid.iter_render()): cartpole_frames.append(cartpole_frame) humanoid_frames.append(humanoid_frame) for expected, actual in zip(cartpole.iter_load(), cartpole_frames): image_utils.assert_images_close(expected, actual) for expected, actual in zip(humanoid.iter_load(), humanoid_frames): image_utils.assert_images_close(expected, actual)
def test_render(self, sequence): for expected, actual in zip(sequence.iter_load(), sequence.iter_render()): image_utils.assert_images_close(expected, actual)