示例#1
0
    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)
示例#2
0
    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)
示例#3
0
 def test__pow__(self, a, b):
     Symbol(a)**Symbol(b)
示例#4
0
 def test__truediv__(self, a, b):
     Symbol(a) / Symbol(b)
示例#5
0
 def test__mul__(self, a, b):
     Symbol(a) * Symbol(b)
示例#6
0
 def test__sub__(self, a, b):
     Symbol(a) - Symbol(b)
示例#7
0
 def test__add__(self, a, b):
     Symbol(a) + Symbol(b)
示例#8
0
 def test_derivative(self, a):
     self.assertEqual(Symbol(a).derivative(), 1)
示例#9
0
 def test__add__(self, a, b):
     if a == b:
         self.assertIsInstance(Symbol(a) + Symbol(b), Multiplication)
     else:
         self.assertIsInstance(Symbol(a) + Symbol(b), Addition)
示例#10
0
 def test__neq__(self, a, b):
     if a == b:
         return
     self.assertNotEqual(Symbol(a), Symbol(b))
示例#11
0
 def test__eq__(self, a):
     self.assertEqual(Symbol(a), Symbol(a))
示例#12
0
 def test__str__(self, a):
     self.assertEqual(str(a), str(Symbol(a)))
示例#13
0
 def test__init__(self, a):
     Symbol(a)
示例#14
0
 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))
示例#15
0
 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)))
示例#16
0
 def test__neq__(self, a, b, c):
     self.assertNotEqual(Addition(a, b), Symbol(c))