Exemple #1
0
 def testradd(self):
     self.b2 = 3 + Bruch(3, 2)
     assert(float(self.b2) == 4.5)
Exemple #2
0
 def test_makeBruchInt(self):
     value = 3
     b4 = Bruch._Bruch__makeBruch(value)
     assert(b4.zaehler == value)
Exemple #3
0
 def testNeg(self):
     b4 = Bruch(-3, 2)
     assert(-b4 == Bruch(3, 2))
Exemple #4
0
 def testTuple(self):
     z, n = Bruch(3, 4)
     assert(z == 3 and n == 4)
Exemple #5
0
 def testInteger(self):
     self.b2 = Bruch(3, 1)
     assert(str(self.b2) == '(3)')
Exemple #6
0
 def testrdivZeroError(self):
     bneu = Bruch(0, 3)
     self.assertRaises(ZeroDivisionError, bneu.__rtruediv__, 3)
Exemple #7
0
 def testiDiv2(self):
     self.b /= Bruch(2)
     assert(self.b == Bruch(3, 4))
Exemple #8
0
 def testiSub(self):
     self.b -= 2
     assert(self.b == Bruch(-1, 2))
Exemple #9
0
 def testiSub2(self):
     self.b -= Bruch(2)
     assert(self.b == Bruch(-1, 2))
Exemple #10
0
 def testminus3(self):
     self.b2 = self.b - Bruch(1)
     assert(float(self.b2) == 0.5)
Exemple #11
0
 def testFloat(self):
     b = Bruch(3, 4)
     assert(float(b) == 0.75)
Exemple #12
0
 def testminus(self):
     self.b = self.b - Bruch(4, 5)
     assert(float(self.b) == 0.7)
Exemple #13
0
 def testiAdd2(self):
     self.b += Bruch(1)
     assert(self.b == Bruch(5, 2))
Exemple #14
0
 def testiAdd(self):
     self.b += 1
     assert(self.b == Bruch(5, 2))
Exemple #15
0
 def testrdiv(self):
     self.b2 = 2 / Bruch(2)
     assert(float(self.b2) == 1)
Exemple #16
0
 def testrsub(self):
     self.b2 = 3 - Bruch(3, 2)
     assert(float(self.b2) == 1.5)
Exemple #17
0
 def testdivZeroError2(self):
     self.assertRaises(ZeroDivisionError, self.b2.__truediv__, Bruch(0, 3))
Exemple #18
0
 def testmal(self):
     self.b = self.b * Bruch(4)
     assert(float(self.b) == 6)
Exemple #19
0
 def testiDiv(self):
     self.b /= 2
     assert(self.b == Bruch(3, 4))
Exemple #20
0
 def testInt(self):
     b = Bruch(5, 4)
     assert(int(b) == 1)
Exemple #21
0
 def testInvert(self):
     z, n = 5, 4
     b = Bruch(z, n)
     assert(~b == Bruch(n, z))
Exemple #22
0
 def testiMul2(self):
     self.b *= Bruch(2)
     assert(self.b == 3)
Exemple #23
0
 def testTuple2(self):
     z, n = self.b
     self.assertEqual(Bruch(z, n), self.b)
Exemple #24
0
 def testrmal(self):
     self.b2 = 2 * Bruch(3, 2)
     assert(float(self.b2) == 3)
Exemple #25
0
 def testPow(self):
     h = 4
     assert(self.b2 ** h == Bruch(self.b2.zaehler ** h, self.b2.nenner ** h))
Exemple #26
0
 def testdiv(self):
     self.b = self.b / Bruch(4)
     assert(float(self.b) == 0.375)
Exemple #27
0
 def testAbs(self):
     b4 = Bruch(-3, 2)
     assert(abs(b4) == Bruch(3, 2))
Exemple #28
0
 def testComplex(self):
     b = Bruch(3, 4)
     assert(complex(b) == 0.75)
Exemple #29
0
 def setUp(self):
     self.b = Bruch(3, 2)
     self.b2 = Bruch(self.b)
     self.b3 = Bruch(4, 2)
     pass
Exemple #30
0
 def testplus(self):
     self.b = self.b + Bruch(4, 5)
     assert(float(self.b) == 2.3)