Skip to content

Commit 703fd34

Browse files
committed
variable type tests
1 parent 79c88a1 commit 703fd34

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

src/pyscipopt/scip.pxi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,7 @@ cdef class Variable(Expr):
15751575
-------
15761576
bool
15771577
"""
1578-
return SCIPvarIsImpliedIntegral(self.scip_var)
1578+
return SCIPvarIsNonImpliedIntegral(self.scip_var)
15791579

15801580
def getImplType(self):
15811581
"""

tests/test_vars.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,17 @@ def test_vtype():
6363
m.chgVarType(x, 'I')
6464
assert x.vtype() == "INTEGER"
6565

66-
m.chgVarType(y, 'M')
67-
assert y.vtype() == "IMPLINT"
66+
m.chgVarType(y, 'C')
67+
assert y.vtype() == "CONTINUOUS"
68+
69+
is_int = lambda x: x.isIntegral() == True
70+
is_implint = lambda x: x.isImpliedIntegral() == True
71+
is_nonimplint = lambda x: x.isNonImpliedIntegral() == True
72+
is_bin = lambda x: x.isBinary() == True
73+
74+
assert not is_int(y) and not is_implint(y) and not is_nonimplint(y) and not is_bin(y)
75+
assert is_int(x) and not is_implint(x) and not is_nonimplint(x) and not is_bin(x)
76+
assert is_int(z) and not is_implint(z) and not is_nonimplint(z) and is_bin(z)
77+
assert w.vtype() == "CONTINUOUS" and is_int(w) and is_implint(w) and is_nonimplint(w) and not is_bin(w)
78+
79+
assert w.getImplType() == 1

0 commit comments

Comments
 (0)