From 365347fae6a86beca26151b1a403820526370fa0 Mon Sep 17 00:00:00 2001 From: lukas-schott Date: Tue, 24 Mar 2020 14:47:49 +0100 Subject: [PATCH] test repeated --- tests/test_spatial_attack.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test_spatial_attack.py b/tests/test_spatial_attack.py index 9839588c..c0e8396d 100644 --- a/tests/test_spatial_attack.py +++ b/tests/test_spatial_attack.py @@ -10,9 +10,10 @@ def get_attack_id(x: fbn.Attack) -> str: # attack -attacks: List[fbn.Attack] = [ - fa.SpatialAttack(), - fa.SpatialAttack(grid_search=False), +attacks: List[Tuple[fbn.Attack, bool]] = [ + (fa.SpatialAttack(), False), + (fa.SpatialAttack(grid_search=False), False), + (fa.SpatialAttack(grid_search=False), True), ] @@ -21,10 +22,12 @@ def test_spatial_attacks( fmodel_and_data_ext_for_attacks: Tuple[ Tuple[fbn.Model, ep.Tensor, ep.Tensor], bool ], - attack_grad_real: fbn.Attack, + attack_grad_real: Tuple[fbn.Attack, bool], ) -> None: - attack = attack_grad_real + attack, repeated = attack_grad_real + if repeated: + attack = attack.repeat(2) (fmodel, x, y), real = fmodel_and_data_ext_for_attacks if not real: pytest.skip()