예제 #1
0
 def testExpMethod(self, bexp, dexp):
     """ Test extracting unit for a given exponent. """
     self.assertEqual(
        BinaryUnits.unit_for_exp(bexp).factor,
        BinaryUnits.FACTOR ** bexp
     )
     self.assertEqual(
        DecimalUnits.unit_for_exp(dexp).factor,
        DecimalUnits.FACTOR ** dexp
     )
예제 #2
0
 def testExpExceptions(self):
     """
     Test that exceptions are properly raised.
     """
     with self.assertRaises(RangeValueError):
         DecimalUnits.unit_for_exp(-1)