Skip to content

Commit 9754f85

Browse files
committed
minor
1 parent 3f625d6 commit 9754f85

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

params/params.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class MyParams(pp.Params):
3636
self.required = required
3737
self.dtype = type(value) if (dtype is None and value is not None) else dtype
3838
if value is not None:
39-
assert isinstance(value, self.dtype)
39+
if not isinstance(value, self.dtype):
40+
raise RuntimeError(f"Param({value}) does not match dtype:[{self.dtype}]")
4041
self.name = None
4142

4243

tests/test_decoration.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ def error_fn(msg, *args, **kwargs):
5555
try:
5656
args = parser.parse_args(["--use-other-things", "f"])
5757
self.fail("ArgumentError expected - required param missing")
58-
except Exception as err:
58+
except Exception:
5959
pass
6060

6161
try:
6262
args = parser.parse_args(["--use-other-things", "1e-6", "--number-of-things", "3"])
6363
self.fail("ArgumentTypeError expected")
64-
except Exception as err:
64+
except Exception:
6565
pass
6666

6767

0 commit comments

Comments
 (0)