Skip to content

Commit aadae4a

Browse files
Merge pull request OpenMined#459 from dvadym/format
Run make format-style-python
2 parents c4da243 + 6e12865 commit aadae4a

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

tests/algorithms/test_numerical_mechanisms.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,8 @@ def test_gaussian_mechanism_create_from_std():
8989
gaussian = num_mech.GaussianMechanism.create_from_standard_deviation(std)
9090
assert gaussian.std == 2
9191
value = gaussian.add_noise(100)
92-
assert 80 <= value <= 120 # in 10*sigma
92+
assert 80 <= value <= 120 # in 10*sigma
9393
assert type(value) is int
9494
value = gaussian.add_noise(200.0)
9595
assert type(value) is float
96-
assert 180 <= value <= 220 # in 10*sigma
97-
96+
assert 180 <= value <= 220 # in 10*sigma

tests/algorithms/test_partition_selection.py

+22-4
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,24 @@ def test_gaussian_keep_and_return_noised_value(
140140
100,
141141
[0, 0, 0.12818308050524607, 1],
142142
),
143-
([10, 99, 109, 200], "laplace", 1, 1e-5, 1, 100, [0, 0, 0.08103083927575383, 1]),
144-
([10, 99, 109, 200], "gaussian", 1, 1e-5, 1, 100, [0, 0, 0.017845473615190732, 1]),
143+
(
144+
[10, 99, 109, 200],
145+
"laplace",
146+
1,
147+
1e-5,
148+
1,
149+
100,
150+
[0, 0, 0.08103083927575383, 1],
151+
),
152+
(
153+
[10, 99, 109, 200],
154+
"gaussian",
155+
1,
156+
1e-5,
157+
1,
158+
100,
159+
[0, 0, 0.017845473615190732, 1],
160+
),
145161
],
146162
)
147163
def test_pre_thresholding(
@@ -152,7 +168,7 @@ def test_pre_thresholding(
152168
delta,
153169
max_partitions_contributed,
154170
pre_threshold,
155-
expected_probs
171+
expected_probs,
156172
):
157173
partition_selector = create_partition_strategy(
158174
strategy, epsilon, delta, max_partitions_contributed, pre_threshold
@@ -175,4 +191,6 @@ def test_pre_thresholding(
175191
assert sum(sims) == 0
176192
else:
177193
pred_prob_of_keep = np.mean(sims)
178-
assert pred_prob_of_keep == pytest.approx(expected_prob, ACCURACY_THRESHOLD)
194+
assert pred_prob_of_keep == pytest.approx(
195+
expected_prob, ACCURACY_THRESHOLD
196+
)

0 commit comments

Comments
 (0)