def test_substitute_into_formula_element(self): e1 = FormulaElement() self.assertEqual( e1.substitute(lambda v: {'x': 42}.get(v.symbol, v)), e1)
def test_merge_formula_element_to_self(self): e1 = FormulaElement() self.assertEqual(e1 | e1, Formula({e1: 2}))
def test_add_formula_element_and_number(self): with self.assertRaises(TypeError): f = FormulaElement() + 42
def test_merge_formula_elements(self): e1 = FormulaElement() e2 = FormulaElement() self.assertEqual(e1 | e2, Formula({e1: 1, e2: 1}))