Пример #1
0
 def test_substitute_into_formula_element(self):
     e1 = FormulaElement()
     self.assertEqual(
         e1.substitute(lambda v: {'x': 42}.get(v.symbol, v)), e1)
Пример #2
0
 def test_merge_formula_element_to_self(self):
     e1 = FormulaElement()
     self.assertEqual(e1 | e1, Formula({e1: 2}))
Пример #3
0
 def test_add_formula_element_and_number(self):
     with self.assertRaises(TypeError):
         f = FormulaElement() + 42
Пример #4
0
 def test_merge_formula_elements(self):
     e1 = FormulaElement()
     e2 = FormulaElement()
     self.assertEqual(e1 | e2, Formula({e1: 1, e2: 1}))
Пример #5
0
 def test_substitute_into_formula_element(self):
     e1 = FormulaElement()
     self.assertEqual(
         e1.substitute(lambda v: {'x': 42}.get(v.symbol, v)), e1)