Exemplo n.º 1
0
 def testRound5(self):
     """
     Test rounding (up) number to no decimal values
     """
     inputNum = 1.7456789
     numDecimals = 0
     expected = 2
     actual = decimalRound(inputNum, numDecimals)
     self.assertEqual(actual, expected)
Exemplo n.º 2
0
 def testRound1(self):
     """
     Test adding zeros after integer when not enough
     """
     inputNum = 1.1
     numDecimals = 3
     expected = 1.100
     actual = decimalRound(inputNum, numDecimals)
     self.assertEqual(actual, expected)
Exemplo n.º 3
0
 def testRound3(self):
     """
     Test rounding number (down) to given decimal point
     """
     inputNum = 1.3426789
     numDecimals = 2
     expected = 1.34
     actual = decimalRound(inputNum, numDecimals)
     self.assertEqual(actual, expected)
Exemplo n.º 4
0
 def testRound0(self):
     """
     Test adding zeros after integer when not enough
     and there currently aren't any decimals
     """
     inputNum = 1
     numDecimals = 2
     expected = 1.00
     actual = decimalRound(inputNum, numDecimals)
     self.assertEqual(actual, expected)