diff --git a/dice/core/constraint.py b/dice/core/constraint.py index f807036..7bfae08 100644 --- a/dice/core/constraint.py +++ b/dice/core/constraint.py @@ -286,8 +286,7 @@ def apply(self, item): """ def _name2path(name): if not name.startswith(self.path_prefix): - raise ConstraintError( - "Solution %s is not a path variable" % name) + return name return name[len(self.path_prefix):].replace('_', '/') t = self._choose() diff --git a/dice/core/trace.py b/dice/core/trace.py index fc34eb0..30733ac 100644 --- a/dice/core/trace.py +++ b/dice/core/trace.py @@ -45,6 +45,8 @@ def __repr__(self): for line in self.trace: if isinstance(line, ast.Compare): s = str(line.ops[0].__class__.__name__) + elif isinstance(line, ast.Call): + s = line.func.id else: s = line.value.func.id lines.append(s) diff --git a/examples/pyramid/oracles/pyramid.yaml b/examples/pyramid/oracles/pyramid.yaml index bb701b3..6543635 100644 --- a/examples/pyramid/oracles/pyramid.yaml +++ b/examples/pyramid/oracles/pyramid.yaml @@ -1,14 +1,13 @@ - name: option - target: option - tree: | - if self is Integer: - if self < 0: + oracle: | + if option is Integer: + if option < 0: return FAIL('Min input is 0') - elif self > 9223372036854775808: + elif option > 9223372036854775808: return FAIL('Number overflow') - elif self > 1000: + elif option > 1000: return FAIL('Max input is 1000') else: - return PASS() + return SUCCESS() else: return FAIL('Invalid number') diff --git a/tox.ini b/tox.ini index c05e22c..3f0966f 100644 --- a/tox.ini +++ b/tox.ini @@ -32,3 +32,4 @@ commands = deps = -rrequirements.txt sphinx + sphinx_rtd_theme