Skip to content

Commit d75ec05

Browse files
committed
Fix typos
Signed-off-by: Beat Buesser <[email protected]>
1 parent 1145d2f commit d75ec05

17 files changed

+36
-36
lines changed

tests/attacks/evasion/test_laser_attack.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
@pytest.fixture(name="close")
3131
def fixture_close() -> Callable:
3232
"""
33-
Comparison function
33+
Comparison function.
3434
:returns: function that checks if two float arrays are close.
3535
"""
3636

@@ -51,7 +51,7 @@ def close(x: np.ndarray, y: np.ndarray):
5151
@pytest.fixture(name="not_close")
5252
def fixture_not_close(close):
5353
"""
54-
Comparison function
54+
Comparison function.
5555
:returns: function that checks if values of two float arrays are not close.
5656
"""
5757

@@ -75,7 +75,7 @@ def not_close(x: np.ndarray, y: np.ndarray) -> bool:
7575
@pytest.fixture(name="less_or_equal")
7676
def fixture_less_or_equal():
7777
"""
78-
Comparison function
78+
Comparison function.
7979
:returns: function that checks if first array is less or equal than the second.
8080
"""
8181

@@ -126,7 +126,7 @@ def fixture_max_laser_beam() -> LaserBeam:
126126
@pytest.fixture(name="laser_generator_fixture")
127127
def fixture_laser_generator_fixture(min_laser_beam, max_laser_beam) -> Callable:
128128
"""
129-
Return a function that returns geneartor of the LaserBeam objects.
129+
Return a function that returns generator of the LaserBeam objects.
130130
131131
:param min_laser_beam: LaserBeam object with minimal acceptable properties.
132132
:param max_laser_beam: LaserBeam object with maximal acceptable properties.
@@ -138,7 +138,7 @@ def fixture_laser_generator_fixture(min_laser_beam, max_laser_beam) -> Callable:
138138
@pytest.fixture(name="laser_generator")
139139
def fixture_laser_generator(min_laser_beam, max_laser_beam) -> LaserBeamGenerator:
140140
"""
141-
Geneartor of the LaserBeam objects.
141+
Generator of the LaserBeam objects.
142142
143143
:param min_laser_beam: LaserBeam object with minimal acceptable properties.
144144
:param max_laser_beam: LaserBeam object with maximal acceptable properties.

tests/attacks/evasion/test_lowprofool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ def test_clipping(iris_dataset):
410410
top_custom = 3
411411
clf_slr_custom = ScikitlearnLogisticRegression(model=lr_clf, clip_values=(bottom_custom, top_custom))
412412

413-
# Setting up LowProFool classes with different hyper-parameters
413+
# Setting up LowProFool classes with different hyperparameters
414414
lpf_min_max_default = LowProFool(classifier=clf_slr_min_max, n_steps=45, eta=0.02, lambd=1.5)
415415
lpf_min_max_high_eta = LowProFool(classifier=clf_slr_min_max, n_steps=45, eta=100000, lambd=1.5)
416416
lpf_custom_default = LowProFool(classifier=clf_slr_custom, n_steps=45, eta=0.02, lambd=1.5)

tests/attacks/evasion/test_pe_malware_attack.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def fix_make_dummy_model():
5858

5959
def get_prediction_model(param_dic):
6060
"""
61-
Model going from embeddings to predictions so we can easily optimise the embedding malware embedding.
61+
Model going from embeddings to predictions, so we can easily optimise the embedding malware embedding.
6262
Needs to have the same structure as the target model.
6363
Populated here with "standard" parameters.
6464
"""
@@ -168,7 +168,7 @@ def test_append_attack(art_warning, fix_get_synthetic_data, fix_make_dummy_model
168168

169169
# We should only have 2 files as the following cannot be converted to valid adv samples:
170170
# 2nd datapoint (file too large to support any modifications)
171-
# 4th datapoint (file to large to support append attacks)
171+
# 4th datapoint (file too large to support append attacks)
172172
# 5th datapoint (benign file)
173173

174174
assert len(adv_x) == 2
@@ -360,7 +360,7 @@ def test_dos_header_attack(art_warning, fix_get_synthetic_data, fix_make_dummy_m
360360
)
361361

362362
# should have 3 files. Samples which are excluded are:
363-
# 2nd datapoint (file to large to support any modifications)
363+
# 2nd datapoint (file too large to support any modifications)
364364
# 5th datapoint (benign file)
365365

366366
assert len(adv_x) == 3
@@ -511,7 +511,7 @@ def test_do_not_check_for_valid(art_warning, fix_get_synthetic_data, fix_make_du
511511

512512
# We expect 2 files to have been made adversarial the following cannot be converted to valid adv samples:
513513
# 2nd datapoint (file too large to support any modifications)
514-
# 4th datapoint (file to large to support append attacks)
514+
# 4th datapoint (file too large to support append attacks)
515515
# 5th datapoint (benign file)
516516
for i, size in enumerate(size_of_files):
517517
if i in [0, 2]:

tests/attacks/poison/test_audio_perturbations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_insert_tone_trigger(art_warning):
3939
assert np.max(audio) != 0
4040
assert np.max(np.abs(audio)) <= 1.0
4141

42-
# test single example with differet duration, frequency, and scale
42+
# test single example with different duration, frequency, and scale
4343
trigger = CacheToneTrigger(sampling_rate=16000, frequency=16000, duration=0.2, scale=0.5)
4444
audio = trigger.insert(x=np.zeros(3200))
4545
assert audio.shape == (3200,)
@@ -88,7 +88,7 @@ def test_insert_audio_trigger(art_warning):
8888
assert np.max(audio) != 0
8989
assert np.max(np.abs(audio)) <= 1.0
9090

91-
# test single example with differet duration and scale
91+
# test single example with different duration and scale
9292
trigger = CacheAudioTrigger(
9393
sampling_rate=16000,
9494
backdoor_path=file_path,

tests/attacks/test_adversarial_patch.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def test_2_tensorflow_numpy(self):
9797
x_out = attack_ap.insert_transformed_patch(
9898
self.x_train_mnist[0], np.ones((14, 14, 1)), np.asarray([[2, 13], [2, 18], [12, 22], [8, 13]])
9999
)
100-
x_out_expexted = np.array(
100+
x_out_expected = np.array(
101101
[
102102
0.0,
103103
0.0,
@@ -130,7 +130,7 @@ def test_2_tensorflow_numpy(self):
130130
],
131131
dtype=np.float32,
132132
)
133-
np.testing.assert_almost_equal(x_out[15, :, 0], x_out_expexted, decimal=3)
133+
np.testing.assert_almost_equal(x_out[15, :, 0], x_out_expected, decimal=3)
134134

135135
if sess is not None:
136136
sess.close()
@@ -166,7 +166,7 @@ def test_3_tensorflow_v2_framework(self):
166166
x_out = attack_ap.insert_transformed_patch(
167167
self.x_train_mnist[0], np.ones((14, 14, 1)), np.asarray([[2, 13], [2, 18], [12, 22], [8, 13]])
168168
)
169-
x_out_expexted = np.array(
169+
x_out_expected = np.array(
170170
[
171171
0.0,
172172
0.0,
@@ -199,7 +199,7 @@ def test_3_tensorflow_v2_framework(self):
199199
],
200200
dtype=np.float32,
201201
)
202-
np.testing.assert_almost_equal(x_out[15, :, 0], x_out_expexted, decimal=3)
202+
np.testing.assert_almost_equal(x_out[15, :, 0], x_out_expected, decimal=3)
203203

204204
mask = np.ones((1, 28, 28)).astype(bool)
205205
attack_ap.apply_patch(x=self.x_train_mnist, scale=0.1, mask=mask)
@@ -240,7 +240,7 @@ def test_6_keras(self):
240240
x_out = attack_ap.insert_transformed_patch(
241241
self.x_train_mnist[0], np.ones((14, 14, 1)), np.asarray([[2, 13], [2, 18], [12, 22], [8, 13]])
242242
)
243-
x_out_expexted = np.array(
243+
x_out_expected = np.array(
244244
[
245245
0.0,
246246
0.0,
@@ -273,7 +273,7 @@ def test_6_keras(self):
273273
],
274274
dtype=np.float32,
275275
)
276-
np.testing.assert_almost_equal(x_out[15, :, 0], x_out_expexted, decimal=3)
276+
np.testing.assert_almost_equal(x_out[15, :, 0], x_out_expected, decimal=3)
277277

278278
def test_4_pytorch(self):
279279
"""

tests/attacks/test_backdoor_attack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def test_backdoor_pixel(self):
140140

141141
def test_backdoor_image(self):
142142
"""
143-
Test the backdoor attack with a image-based perturbation can be trained on classifier
143+
Test the backdoor attack with an image-based perturbation can be trained on classifier
144144
"""
145145
krc = get_image_classifier_kr()
146146
(is_poison_train, x_poisoned_raw, y_poisoned_raw) = self.poison_dataset(

tests/attacks/test_targeted_universal_perturbation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TestTargetedUniversalPerturbation(TestBase):
4242
4343
This module tests the Targeted Universal Perturbation.
4444
45-
| Paper link: https://arxiv.org/abs/1911.06502)
45+
| Paper link: https://arxiv.org/abs/1911.06502
4646
"""
4747

4848
@classmethod

tests/defences/preprocessor/test_mp3_compression.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def test_non_temporal_data_error(art_warning, image_batch_small):
8484

8585
@pytest.mark.parametrize("channels_first", [True, False])
8686
@pytest.mark.skip_framework("keras", "pytorch", "scikitlearn", "mxnet")
87-
def test_mp3_compresssion(art_warning, audio_batch, channels_first):
87+
def test_mp3_compression(art_warning, audio_batch, channels_first):
8888
try:
8989
test_input, test_output, sample_rate = audio_batch
9090
mp3compression = Mp3Compression(sample_rate=sample_rate, channels_first=channels_first)
@@ -96,7 +96,7 @@ def test_mp3_compresssion(art_warning, audio_batch, channels_first):
9696

9797
@pytest.mark.parametrize("channels_first", [True, False])
9898
@pytest.mark.skip_framework("keras", "pytorch", "scikitlearn", "mxnet")
99-
def test_mp3_compresssion_object(art_warning, audio_batch, channels_first):
99+
def test_mp3_compression_object(art_warning, audio_batch, channels_first):
100100
try:
101101
test_input, test_output, sample_rate = audio_batch
102102
test_input_object = np.array([x for x in test_input], dtype=object)

tests/defences/preprocessor/test_mp3_compression_pytorch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_non_temporal_data_error(art_warning, image_batch_small):
8686

8787
@pytest.mark.parametrize("channels_first", [True, False])
8888
@pytest.mark.skip_framework("tensorflow", "keras", "scikitlearn", "mxnet", "kerastf")
89-
def test_mp3_compresssion(art_warning, audio_batch, channels_first):
89+
def test_mp3_compression(art_warning, audio_batch, channels_first):
9090
try:
9191
test_input, test_output, sample_rate = audio_batch
9292
mp3compression = Mp3CompressionPyTorch(sample_rate=sample_rate, channels_first=channels_first)

tests/defences/preprocessor/test_video_compression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def video_batch(channels_first):
4444

4545
@pytest.mark.parametrize("channels_first", [True, False])
4646
@pytest.mark.skip_framework("keras", "pytorch", "scikitlearn", "mxnet")
47-
def test_video_compresssion(art_warning, video_batch, channels_first):
47+
def test_video_compression(art_warning, video_batch, channels_first):
4848
try:
4949
test_input, test_output = video_batch
5050
video_compression = VideoCompression(video_format="mp4", constant_rate_factor=0, channels_first=channels_first)

0 commit comments

Comments
 (0)