def test_two_calls_compute_budgets_raise_exception(self): budget_accountant = PLDBudgetAccountant(total_epsilon=1, total_delta=1e-6) budget_accountant.request_budget(mechanism_type=MechanismType.LAPLACE) budget_accountant.compute_budgets() with self.assertRaises(Exception): # Budget can be computed only once. budget_accountant.compute_budgets()
def test_request_after_compute_raise_exception(self): budget_accountant = PLDBudgetAccountant(total_epsilon=1, total_delta=1e-6) budget_accountant.request_budget(mechanism_type=MechanismType.LAPLACE) budget_accountant.compute_budgets() with self.assertRaises(Exception): # Budget can not be requested after it has been already computed. budget_accountant.request_budget( mechanism_type=MechanismType.LAPLACE)
def test_invalid_gaussian_delta(self): accountant = PLDBudgetAccountant(total_epsilon=1, total_delta=0) with self.assertRaises(AssertionError): accountant.request_budget(MechanismType.GAUSSIAN)