def test_flip_raise_config_error_if_mode_unknown(self): with pytest.raises(ConfigError): Flip({'type': 'flip', 'mode': 'unknown'})
def test_vertical_flip(self): image = np.random.randint(0, 255, (30, 40, 3)) expected_image = cv2.flip(image, 1) flip = Flip({'type': 'flip', 'mode': 'vertical'}) assert np.array_equal(expected_image, flip.process(DataRepresentation(image)).data)
def test_flip_default_value_if_mode_not_provided(self): flip = Flip({'type': 'flip'}) assert np.array_equal(0, flip.mode)
def test_flip_raise_config_error_if_mode_not_provided(self): with pytest.raises(ConfigError): Flip({'type': 'flip'})