Example #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
     )
Example #2
0
 def testExpExceptions(self):
     """
     Test that exceptions are properly raised.
     """
     with self.assertRaises(RangeValueError):
         DecimalUnits.unit_for_exp(-1)