提交 f17a8cde authored 作者: Brandon T. Willard's avatar Brandon T. Willard

More informative warnings when scan cannot compute test values

上级 d0458048
...@@ -525,17 +525,16 @@ def scan( ...@@ -525,17 +525,16 @@ def scan(
if config.compute_test_value != "off": if config.compute_test_value != "off":
try: try:
nw_slice.tag.test_value = gof.get_test_value(_seq_val_slice) nw_slice.tag.test_value = gof.get_test_value(_seq_val_slice)
except TestValueError as e: except TestValueError:
if config.compute_test_value != "ignore": if config.compute_test_value != "ignore":
# No need to print a warning or raise an error now, # No need to print a warning or raise an error now,
# it will be done when fn will be called. # it will be done when fn will be called.
_logger.info( _logger.warning(
( (
"Cannot compute test value for " "Cannot compute test value for "
"the inner function of scan, input value " "the inner function of scan, input value "
"missing %s" "missing {}"
), ).format(_seq_val_slice)
e,
) )
# Add names to slices for debugging and pretty printing .. # Add names to slices for debugging and pretty printing ..
...@@ -657,16 +656,13 @@ def scan( ...@@ -657,16 +656,13 @@ def scan(
if config.compute_test_value != "off": if config.compute_test_value != "off":
try: try:
arg.tag.test_value = gof.get_test_value(actual_arg) arg.tag.test_value = gof.get_test_value(actual_arg)
except TestValueError as e: except TestValueError:
if config.compute_test_value != "ignore": if config.compute_test_value != "ignore":
# No need to print a warning or raise an error now, _logger.warning(
# it will be done when fn will be called.
_logger.info(
( (
"Cannot compute test value for the " "Cannot compute test value for the "
"inner function of scan, input value missing %s" "inner function of scan, test value missing: {}"
), ).format(actual_arg)
e,
) )
if getattr(init_out["initial"], "name", None) is not None: if getattr(init_out["initial"], "name", None) is not None:
...@@ -720,17 +716,14 @@ def scan( ...@@ -720,17 +716,14 @@ def scan(
nw_slice.tag.test_value = gof.get_test_value( nw_slice.tag.test_value = gof.get_test_value(
_init_out_var_slice _init_out_var_slice
) )
except TestValueError as e: except TestValueError:
if config.compute_test_value != "ignore": if config.compute_test_value != "ignore":
# No need to print a warning or raise an error now, _logger.warning(
# it will be done when fn will be called.
_logger.info(
( (
"Cannot compute test value for " "Cannot compute test value for "
"the inner function of scan, input value " "the inner function of scan, test value "
"missing. %s" "missing: {}"
), ).format(_init_out_var_slice)
e,
) )
# give it a name or debugging and pretty printing # give it a name or debugging and pretty printing
...@@ -809,10 +802,8 @@ def scan( ...@@ -809,10 +802,8 @@ def scan(
_logger.warning( _logger.warning(
( (
"When the number of steps is fixed and equal " "When the number of steps is fixed and equal "
"to 1, the provided stopping condition, ", "to 1, the provided stopping condition, {} is ignored",
str(condition), ).format(condition)
" is ignored",
)
) )
for pos, inner_out in enumerate(outputs): for pos, inner_out in enumerate(outputs):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论