Skip to content

Commit

Permalink
fix argument check
Browse files Browse the repository at this point in the history
  • Loading branch information
kwotsin committed Aug 12, 2020
1 parent 88b1b71 commit 86514d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions tests/metrics/test_compute_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ def test_arguments(self):
evaluate_range=('a', 'b', 'c'),
device=self.device)

with pytest.raises(ValueError):
compute_metrics.evaluate(metric=metric,
log_dir=self.log_dir,
netG=self.netG,
dataset=self.dataset,
evaluate_range=(100, 100, 100, 100),
device=self.device)

with pytest.raises(ValueError):
compute_metrics.evaluate(metric=metric,
log_dir=self.log_dir,
Expand Down
2 changes: 1 addition & 1 deletion torch_mimicry/metrics/compute_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def evaluate(metric,
if evaluate_range:
if (type(evaluate_range) != tuple
or not all(map(lambda x: type(x) == int, evaluate_range))
or not len(x) == 3):
or not len(evaluate_range) == 3):
raise ValueError(
"evaluate_range must be a tuple of ints (start, end, step).")

Expand Down

0 comments on commit 86514d2

Please sign in to comment.