Remove assert statements following codacy security recommendation

"Use of assert detected. The enclosed code will be removed when compiling to
optimised byte code."
This commit is contained in:
blackfly
2020-04-11 15:45:29 +02:00
parent 955661af95
commit 8f3a43f62a
2 changed files with 20 additions and 6 deletions

View File

@@ -94,14 +94,14 @@ class TestPrototypes(unittest.TestCase):
dtype=torch.int32)
def test_prototypes1d_inputndim_with_data(self):
with self.assertRaises(AssertionError):
with self.assertRaises(ValueError):
_ = prototypes.Prototypes1D(input_dim=1,
nclasses=1,
prototypes_per_class=1,
data=[[1.], [1]])
def test_prototypes1d_inputdim_with_data(self):
with self.assertRaises(AssertionError):
with self.assertRaises(ValueError):
_ = prototypes.Prototypes1D(
input_dim=2,
nclasses=1,
@@ -110,7 +110,7 @@ class TestPrototypes(unittest.TestCase):
data=[[[1.]], [1]])
def test_prototypes1d_nclasses_with_data(self):
with self.assertRaises(AssertionError):
with self.assertRaises(ValueError):
_ = prototypes.Prototypes1D(
input_dim=1,
nclasses=1,
@@ -194,3 +194,7 @@ class TestLosses(unittest.TestCase):
def tearDown(self):
pass
if __name__ == '__main__':
unittest.main()