Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions blueprint/src/python/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,8 @@ def __repr__(self):
return f"{sympy.latex(sympy.simplify(self.num / self.den))}"

def __eq__(self, other):
if not isinstance(other, RationalFunction):
return NotImplemented
res = self.num * other.den - self.den * other.num

# Direct test if result is numeric
Expand Down
2 changes: 2 additions & 0 deletions blueprint/src/python/polytope.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def __repr__(self):
return f"{f} = 0"

def __eq__(self, other):
if not isinstance(other, Constraint):
return NotImplemented
if (
len(self.coefficients) != len(other.coefficients)
or self.inequality_type != other.inequality_type
Expand Down
1 change: 1 addition & 0 deletions blueprint/src/python/tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
print("All Polytope test cases passed.")

import test_rationalfunction
import test_rationalfunction_eq_regression
import test_rational_roots_regression

print("All RationalFunction test cases passed.")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from functions import RationalFunction as R


def run_regressions():
assert (R([1]) == 3) is False


run_regressions()
Loading