assertExpressionsStructurallyEqual

(function from pyomo.core.expr.compare)

pyomo.core.expr.compare.assertExpressionsStructurallyEqual(test, a, b, include_named_exprs=True, places=None)[source]

unittest-based assertion for comparing expressions

This converts the expressions a and b into prefix notation and then compares the resulting lists. Operators and (non-native type) leaf nodes in the prefix representation are converted to strings before comparing (so that things like variables can be compared across clones or pickles)

Parameters:
  • test (unittest.TestCase) – The unittest TestCase class that is performing the test.

  • a (ExpressionBase or native type)

  • b (ExpressionBase or native type)

  • include_named_exprs (bool) – If True (the default), the comparison expands all named expressions when generating the prefix notation

  • places (int) – Number of decimal places required for equality of floating point numbers in the expression. If None (the default), the expressions must be exactly equal.