Skip to content

Commit

Permalink
Merge pull request #372 from pysmt/coverage/clean_up
Browse files Browse the repository at this point in the history
CI: Tests clean-up and disable coverage
  • Loading branch information
mikand committed Oct 17, 2016
2 parents 15de542 + 78beecc commit b5b59fc
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 17 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[run]
omit = pysmt/cmd/*
pysmt/test/*

[report]
exclude_lines =
Expand Down
7 changes: 7 additions & 0 deletions pysmt/test/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ def get_full_example_formulae(environment=None):
logic=pysmt.logics.QF_BOOL
),

Example(hr="((x | y) & (! (x | y)))",
expr=And(Or(x, y), Not(Or(x, y))),
is_valid=False,
is_sat=False,
logic=pysmt.logics.QF_BOOL
),

#
# LIA
#
Expand Down
2 changes: 1 addition & 1 deletion pysmt/test/test_back.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def do_back(self, solver_name, z3_string_buffer=False):
try:
s = Solver(name=solver_name, logic=logic)
term = s.converter.convert(formula)
if solver_name == "z3" and z3_string_buffer:
if solver_name == "z3":
if z3_string_buffer:
res = s.converter.back_via_smtlib(term)
else:
Expand Down
8 changes: 4 additions & 4 deletions pysmt/test/test_typechecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,16 @@ def test_assert_args(self):


def test_decorator_typecheck_result(self):
from pysmt.fnode import FNode, FNodeContent
from pysmt.operators import AND
@typecheck_result
def good_function():
return self.x

@typecheck_result
def super_bad_function():
sb = And(self.x, self.y)
# !!! This hurts so badly !!!
# !!! Do not try this at home !!!
sb._content.args[0] = self.p
sb = FNode(FNodeContent(node_type=AND, args=(self.p, self.p),
payload=None), -1)
return sb

good_function()
Expand Down
26 changes: 15 additions & 11 deletions pysmt/test/test_walkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import pysmt.operators as op
from six.moves import xrange

import pysmt.operators as op
from pysmt.shortcuts import FreshSymbol, Symbol, Int, Bool, ForAll
from pysmt.shortcuts import And, Or, Iff, Not, Function, Real
from pysmt.shortcuts import LT, GT, Plus, Minus, Equals
Expand All @@ -27,8 +28,7 @@
from pysmt.formula import FormulaManager
from pysmt.test.examples import get_example_formulae
from pysmt.exceptions import UnsupportedOperatorError

from six.moves import xrange
from pysmt.substituter import MSSubstituter


class TestWalkers(TestCase):
Expand Down Expand Up @@ -144,21 +144,25 @@ def test_substitution_on_quantifiers(self):

def test_substitution_complex(self):
x, y = FreshSymbol(REAL), FreshSymbol(REAL)

# y = 0 /\ (Forall x. x > 3 /\ y < 2)
f = And(Equals(y, Real(0)),
ForAll([x], And(GT(x, Real(3)), LT(y, Real(2)))))

if "MSS" in str(self.env.SubstituterClass):
subs = {y: Real(0),
ForAll([x], And(GT(x, Real(3)), LT(Real(0), Real(2)))): TRUE()}
else:
assert "MGS" in str(self.env.SubstituterClass)
subs = {y: Real(0),
ForAll([x], And(GT(x, Real(3)), LT(y, Real(2)))): TRUE()}
subs = {y: Real(0),
ForAll([x], And(GT(x, Real(3)), LT(y, Real(2)))): TRUE()}
f_subs = substitute(f, subs).simplify()
self.assertEqual(f_subs, TRUE())

def test_substitution_complex_mss(self):
x, y = FreshSymbol(REAL), FreshSymbol(REAL)
# y = 0 /\ (Forall x. x > 3 /\ y < 2)
f = And(Equals(y, Real(0)),
ForAll([x], And(GT(x, Real(3)), LT(y, Real(2)))))
subs = {y: Real(0),
ForAll([x], And(GT(x, Real(3)), LT(Real(0), Real(2)))): TRUE()}
f_subs = MSSubstituter(env=self.env).substitute(f, subs).simplify()
self.assertEqual(f_subs, TRUE())

def test_substitution_term(self):
x, y = FreshSymbol(REAL), FreshSymbol(REAL)

Expand Down
2 changes: 1 addition & 1 deletion pysmt/type_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def _get_key(self, formula, **kwargs):
def get_type(self, formula):
""" Returns the pysmt.types type of the formula """
res = self.walk(formula)
if not self.be_nice and res is None:
if not self.be_nice and res is None:
raise TypeError("The formula '%s' is not well-formed" % str(formula))
return res

Expand Down

0 comments on commit b5b59fc

Please sign in to comment.