def test_comparing_derived_with_derived_acceleration_less(self): a1 = quantity.Acceleration(1, "m s-2") a2 = quantity.Acceleration(2, "m s-2") self.assertFalse(a1 == a2) self.assertTrue(a1 <= a2) self.assertFalse(a1 >= a2) self.assertFalse(a1 > a2) self.assertTrue(a1 < a2) self.assertTrue(a1 != a2)
def test_acceleration_name_m_s2(self): a = quantity.Acceleration(2, "m s2") self.assertEquals(str(a), "2.0 m s\u207B\u00B2")
def test_force_from_m_a_233(self): m = quantity.Mass(2.33, "kg") a = quantity.Acceleration(1, 'm s-2') f1 = m * a self.assertEqual(f1('kg m s-2'), float('2.33'))
def test_force_from_m_a_zero(self): m = quantity.Mass(0, "g") a = quantity.Acceleration(0, 'm s-2') f1 = m * a self.assertIsInstance(f1, quantity.Force) self.assertEqual(f1('kg m s-2'), float('0.'))
def test_converting_acceleration(self): a = quantity.Acceleration(1.0, 'm s-2') self.assertEqual(a('in s-2'), float('39.37007874015748031496062992')) self.assertEqual(a('in ms-2'), float('0.00003937007874015748031496062992'))