From 6e1286526025871867eeb6d2585d527857a828a9 Mon Sep 17 00:00:00 2001 From: Vadym Doroshenko Date: Sun, 28 May 2023 11:04:59 +0200 Subject: [PATCH] Run make format-style-python --- tests/algorithms/test_numerical_mechanisms.py | 5 ++-- tests/algorithms/test_partition_selection.py | 26 ++++++++++++++++--- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/tests/algorithms/test_numerical_mechanisms.py b/tests/algorithms/test_numerical_mechanisms.py index 2f6d0103..d14048e3 100644 --- a/tests/algorithms/test_numerical_mechanisms.py +++ b/tests/algorithms/test_numerical_mechanisms.py @@ -89,9 +89,8 @@ def test_gaussian_mechanism_create_from_std(): gaussian = num_mech.GaussianMechanism.create_from_standard_deviation(std) assert gaussian.std == 2 value = gaussian.add_noise(100) - assert 80 <= value <= 120 # in 10*sigma + assert 80 <= value <= 120 # in 10*sigma assert type(value) is int value = gaussian.add_noise(200.0) assert type(value) is float - assert 180 <= value <= 220 # in 10*sigma - + assert 180 <= value <= 220 # in 10*sigma diff --git a/tests/algorithms/test_partition_selection.py b/tests/algorithms/test_partition_selection.py index c0aad407..c6424e3e 100644 --- a/tests/algorithms/test_partition_selection.py +++ b/tests/algorithms/test_partition_selection.py @@ -140,8 +140,24 @@ def test_gaussian_keep_and_return_noised_value( 100, [0, 0, 0.12818308050524607, 1], ), - ([10, 99, 109, 200], "laplace", 1, 1e-5, 1, 100, [0, 0, 0.08103083927575383, 1]), - ([10, 99, 109, 200], "gaussian", 1, 1e-5, 1, 100, [0, 0, 0.017845473615190732, 1]), + ( + [10, 99, 109, 200], + "laplace", + 1, + 1e-5, + 1, + 100, + [0, 0, 0.08103083927575383, 1], + ), + ( + [10, 99, 109, 200], + "gaussian", + 1, + 1e-5, + 1, + 100, + [0, 0, 0.017845473615190732, 1], + ), ], ) def test_pre_thresholding( @@ -152,7 +168,7 @@ def test_pre_thresholding( delta, max_partitions_contributed, pre_threshold, - expected_probs + expected_probs, ): partition_selector = create_partition_strategy( strategy, epsilon, delta, max_partitions_contributed, pre_threshold @@ -175,4 +191,6 @@ def test_pre_thresholding( assert sum(sims) == 0 else: pred_prob_of_keep = np.mean(sims) - assert pred_prob_of_keep == pytest.approx(expected_prob, ACCURACY_THRESHOLD) + assert pred_prob_of_keep == pytest.approx( + expected_prob, ACCURACY_THRESHOLD + )