def testradd(self): self.b2 = 3 + Bruch(3, 2) assert(float(self.b2) == 4.5)
def test_makeBruchInt(self): value = 3 b4 = Bruch._Bruch__makeBruch(value) assert(b4.zaehler == value)
def testNeg(self): b4 = Bruch(-3, 2) assert(-b4 == Bruch(3, 2))
def testTuple(self): z, n = Bruch(3, 4) assert(z == 3 and n == 4)
def testInteger(self): self.b2 = Bruch(3, 1) assert(str(self.b2) == '(3)')
def testrdivZeroError(self): bneu = Bruch(0, 3) self.assertRaises(ZeroDivisionError, bneu.__rtruediv__, 3)
def testiDiv2(self): self.b /= Bruch(2) assert(self.b == Bruch(3, 4))
def testiSub(self): self.b -= 2 assert(self.b == Bruch(-1, 2))
def testiSub2(self): self.b -= Bruch(2) assert(self.b == Bruch(-1, 2))
def testminus3(self): self.b2 = self.b - Bruch(1) assert(float(self.b2) == 0.5)
def testFloat(self): b = Bruch(3, 4) assert(float(b) == 0.75)
def testminus(self): self.b = self.b - Bruch(4, 5) assert(float(self.b) == 0.7)
def testiAdd2(self): self.b += Bruch(1) assert(self.b == Bruch(5, 2))
def testiAdd(self): self.b += 1 assert(self.b == Bruch(5, 2))
def testrdiv(self): self.b2 = 2 / Bruch(2) assert(float(self.b2) == 1)
def testrsub(self): self.b2 = 3 - Bruch(3, 2) assert(float(self.b2) == 1.5)
def testdivZeroError2(self): self.assertRaises(ZeroDivisionError, self.b2.__truediv__, Bruch(0, 3))
def testmal(self): self.b = self.b * Bruch(4) assert(float(self.b) == 6)
def testiDiv(self): self.b /= 2 assert(self.b == Bruch(3, 4))
def testInt(self): b = Bruch(5, 4) assert(int(b) == 1)
def testInvert(self): z, n = 5, 4 b = Bruch(z, n) assert(~b == Bruch(n, z))
def testiMul2(self): self.b *= Bruch(2) assert(self.b == 3)
def testTuple2(self): z, n = self.b self.assertEqual(Bruch(z, n), self.b)
def testrmal(self): self.b2 = 2 * Bruch(3, 2) assert(float(self.b2) == 3)
def testPow(self): h = 4 assert(self.b2 ** h == Bruch(self.b2.zaehler ** h, self.b2.nenner ** h))
def testdiv(self): self.b = self.b / Bruch(4) assert(float(self.b) == 0.375)
def testAbs(self): b4 = Bruch(-3, 2) assert(abs(b4) == Bruch(3, 2))
def testComplex(self): b = Bruch(3, 4) assert(complex(b) == 0.75)
def setUp(self): self.b = Bruch(3, 2) self.b2 = Bruch(self.b) self.b3 = Bruch(4, 2) pass
def testplus(self): self.b = self.b + Bruch(4, 5) assert(float(self.b) == 2.3)