Skip to content

Commit

Permalink
use CleverHansTest
Browse files Browse the repository at this point in the history
  • Loading branch information
goodfeli committed Aug 31, 2017
1 parent 01fa82c commit e0036e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
15 changes: 1 addition & 14 deletions tests_tf/test_attacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import unittest
import numpy as np
import time

from cleverhans.devtools.checks import CleverHansTest
from cleverhans.attacks import Attack
from cleverhans.attacks import FastGradientMethod
from cleverhans.attacks import BasicIterativeMethod
Expand All @@ -15,19 +15,6 @@
from cleverhans.attacks import CarliniWagnerL2


class CleverHansTest(unittest.TestCase):
def setUp(self):
self.test_start = time.time()
# seed the randomness
np.random.seed(1234)

def tearDown(self):
print(self.id(), "took", time.time() - self.test_start, "seconds")

def assertClose(self, x, y):
# self.assertTrue(np.allclose(x, y)) doesn't give a useful message
# on failure
assert np.allclose(x, y), (x, y)


class TestAttackClassInitArguments(CleverHansTest):
Expand Down
4 changes: 3 additions & 1 deletion tests_tf/test_mnist_tutorial_tf.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import unittest
import numpy as np

from cleverhans.devtools.checks import CleverHansTest

class TestMNISTTutorialTF(unittest.TestCase):

class TestMNISTTutorialTF(CleverHansTest):
def test_mnist_tutorial_tf(self):

np.random.seed(42)
Expand Down

0 comments on commit e0036e2

Please sign in to comment.