summaryrefslogtreecommitdiff
path: root/pint/registry_helpers.py
diff options
context:
space:
mode:
authorHernan <hernan.grecco@gmail.com>2019-12-28 03:19:00 -0300
committerHernan <hernan.grecco@gmail.com>2019-12-28 03:19:00 -0300
commit3a582af9e288a761b3c15d9c38fc205b232f39f5 (patch)
tree7a3365827eeef143bb36ebaa58ce95085cbb7eba /pint/registry_helpers.py
parent2d5374f9ab5157a546d43b444d5ac92fa05a8892 (diff)
downloadpint-3a582af9e288a761b3c15d9c38fc205b232f39f5.tar.gz
Add None case to valid values
Diffstat (limited to 'pint/registry_helpers.py')
-rw-r--r--pint/registry_helpers.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/pint/registry_helpers.py b/pint/registry_helpers.py
index 5217095..970f2ef 100644
--- a/pint/registry_helpers.py
+++ b/pint/registry_helpers.py
@@ -214,7 +214,7 @@ def wraps(ureg, ret, args, strict=True):
args = (args,)
for arg in args:
- if not isinstance(arg, (ureg.Unit, str)):
+ if arg is not None and not isinstance(arg, (ureg.Unit, str)):
raise TypeError(
"wraps arguments must by of type str or Unit, not %s (%s)"
% (type(arg), arg)
@@ -225,14 +225,14 @@ def wraps(ureg, ret, args, strict=True):
is_ret_container = isinstance(ret, (list, tuple))
if is_ret_container:
for arg in ret:
- if not isinstance(arg, (ureg.Unit, str)):
+ if arg is not None and not isinstance(arg, (ureg.Unit, str)):
raise TypeError(
"wraps 'ret' argument must by of type str or Unit, not %s (%s)"
% (type(arg), arg)
)
ret = ret.__class__([_to_units_container(arg, ureg) for arg in ret])
else:
- if not isinstance(ret, (ureg.Unit, str)):
+ if ret is not None and not isinstance(ret, (ureg.Unit, str)):
raise TypeError(
"wraps 'ret' argument must by of type str or Unit, not %s (%s)"
% (type(ret), ret)