def testConstruction(self): a1 = Angle(1.0) a2 = Angle.fromRadians(1.0) a3 = Angle.fromDegrees(57.29577951308232) self.assertEqual(a1, a2) self.assertEqual(a1.asRadians(), 1.0) self.assertEqual(a1, a3) self.assertEqual(a1.asDegrees(), 57.29577951308232)
def testConstruction(self): a1 = Angle(1.0) a2 = Angle.fromRadians(1.0) a3 = Angle.fromDegrees(57.29577951308232) self.assertEqual(a1, a2) self.assertEqual(a1.asRadians(), 1.0) self.assertEqual(a1, a3) self.assertEqual(a1.asDegrees(), 57.29577951308232)
def testArithmeticOperators(self): a = Angle(1) b = -a self.assertEqual(a + b, Angle(0)) self.assertEqual(a - b, 2.0 * a) self.assertEqual(a - b, a * 2.0) self.assertEqual(a / 1.0, a) self.assertEqual(a / a, 1.0) a += a a *= 2 a -= b a /= 5 self.assertEqual(a.asRadians(), 1)
def testArithmeticOperators(self): a = Angle(1) b = -a self.assertEqual(a + b, Angle(0)) self.assertEqual(a - b, 2.0 * a) self.assertEqual(a - b, a * 2.0) self.assertEqual(a / 1.0, a) self.assertEqual(a / a, 1.0) a += a a *= 2 a -= b a /= 5 self.assertEqual(a.asRadians(), 1)