<commit_before>import numpy as np

from foolbox.attacks import SpatialAttack as Attack


def test_attack(bn_adversarial):
    adv = bn_adversarial
    attack = Attack()
    attack(adv)
    assert adv.image is not None
    assert adv.distance.value < np.inf


def test_attack_gl(gl_bn_adversarial):
    adv = gl_bn_adversarial
    attack = Attack()
    attack(adv)
    assert adv.image is not None
    assert adv.distance.value < np.inf<commit_msg>added additional tests<commit_after>import numpy as np

from foolbox.attacks import SpatialAttack as Attack


def test_attack_pytorch(bn_adversarial_pytorch):
    adv = bn_adversarial_pytorch
    attack = Attack()
    attack(adv)
    assert adv.image is not None
    assert adv.distance.value < np.inf

    
def test_attack(bn_adversarial):
    adv = bn_adversarial
    attack = Attack()
    attack(adv)
    assert adv.image is not None
    assert adv.distance.value < np.inf


def test_attack_rnd(bn_adversarial):
    adv = bn_adversarial
    attack = Attack()
    attack(adv, random_sampling=True)
    assert adv.image is not None
    assert adv.distance.value < np.inf


def test_attack_norot(bn_adversarial):
    adv = bn_adversarial
    attack = Attack()
    attack(adv, do_rotations=False)
    assert adv.image is not None
    assert adv.distance.value < np.inf


def test_attack_notrans(bn_adversarial):
    adv = bn_adversarial
    attack = Attack()
    attack(adv, do_translations=False)
    assert adv.image is not None
    assert adv.distance.value < np.inf


def test_attack_notrans_norot(bn_adversarial):
    adv = bn_adversarial
    attack = Attack()
    attack(adv, do_translations=False, do_rotations=False)
    assert adv.image is None
    assert adv.distance.value == np.inf  


def test_attack_gl(gl_bn_adversarial):
    adv = gl_bn_adversarial
    attack = Attack()
    attack(adv)
    assert adv.image is not None
    assert adv.distance.value < np.inf
{'fraction_non_alphanumeric': 0.07552083333333333, 'fraction_numerical': 0.0, 'mean_word_length': 3.45707656612529, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3295815', 'n_tokens_mistral': 682, 'n_tokens_neox': 635, 'n_words': 160}