Example #1
0
 def test_round_fractions_full_precision(self):
     obs = _round_fractions([0.01234567890, 0.01234567891])
     self.assertEqual(obs, ['0.0123456789', '0.01234567891'])
Example #2
0
 def test_round_fractions_3_decimals(self):
     obs = _round_fractions([0.1236, 0.45, 0.123])
     self.assertEqual(obs, ['0.124', '0.450', '0.123'])
Example #3
0
 def test_round_fractions_4_decimals(self):
     obs = _round_fractions([0.1234, 0.45, 0.0, 0.12346])
     self.assertEqual(obs, ['0.1234', '0.4500', '0.0000', '0.1235'])
Example #4
0
    def test_round_fractions_single(self):
        obs = _round_fractions([0.0])
        self.assertEqual(obs, ['0.000'])

        obs = _round_fractions([0.1236])
        self.assertEqual(obs, ['0.124'])