def test_image_failure_modes(self):
        """
        Tests failure modes for image perturbation functions
        """
        backdoor_attack = PoisoningAttackBackdoor(self.poison_func_5)
        adv_target = np.argmax(self.y_train_mnist) + 1 % 10
        with self.assertRaises(ValueError) as context:
            backdoor_attack.poison(self.x_train_mnist, y=adv_target)

        self.assertIn("Backdoor does not fit inside original image", str(context.exception))

        backdoor_attack = PoisoningAttackBackdoor(self.poison_func_6)

        with self.assertRaises(ValueError) as context:
            backdoor_attack.poison(np.zeros(5), y=np.ones(5))

        self.assertIn("Invalid array shape", str(context.exception))

        Tests failure modes for image perturbation functions
        
tests/attacks/test_backdoor_attack.py