def test__add__(self, a, b, c, d): if len(set([a, b, c, d])) != 4: return self.assertIsInstance(Subtraction(a, b) + Subtraction(c, d), Addition) self.assertIsInstance(Subtraction(a, b) + Symbol(c), Addition) self.assertIsInstance(Symbol(a) + Subtraction(b, c), Addition)
def test__sub__(self, a, b, c, d): if len(set([a, b, c, d])) != 4: return self.assertIsInstance( Subtraction(a, b) - Subtraction(c, d), Subtraction) self.assertIsInstance(Subtraction(a, b) - Symbol(c), Subtraction) self.assertIsInstance(Symbol(a) - Subtraction(b, c), Subtraction)
def test__pow__(self, a, b): Symbol(a)**Symbol(b)
def test__truediv__(self, a, b): Symbol(a) / Symbol(b)
def test__mul__(self, a, b): Symbol(a) * Symbol(b)
def test__sub__(self, a, b): Symbol(a) - Symbol(b)
def test__add__(self, a, b): Symbol(a) + Symbol(b)
def test_derivative(self, a): self.assertEqual(Symbol(a).derivative(), 1)
def test__add__(self, a, b): if a == b: self.assertIsInstance(Symbol(a) + Symbol(b), Multiplication) else: self.assertIsInstance(Symbol(a) + Symbol(b), Addition)
def test__neq__(self, a, b): if a == b: return self.assertNotEqual(Symbol(a), Symbol(b))
def test__eq__(self, a): self.assertEqual(Symbol(a), Symbol(a))
def test__str__(self, a): self.assertEqual(str(a), str(Symbol(a)))
def test__init__(self, a): Symbol(a)
def test__neq__(self, a, b, c): self.assertNotEqual(Subtraction(a, b), Symbol(c)) if a != b: self.assertNotEqual(Subtraction(a, b), Subtraction(b, a))
def test__eq__(self, a, b): self.assertEqual(Subtraction(a, b), Subtraction(a, b)) self.assertEqual(Subtraction(a, b), Addition(a, -Symbol(b))) self.assertEqual(Subtraction(a, b), Subtraction(-Symbol(b), -Symbol(a)))
def test__neq__(self, a, b, c): self.assertNotEqual(Addition(a, b), Symbol(c))