1   
 2   
 3   
 4   
 5   
 6   
 7   
 8   
 9   
10   
11   
12   
13   
14   
15   
16   
17   
18   
19   
20   
21   
22   
23  """Unit tests of the lib.mathematics module.""" 
24   
25   
26  from unittest import TestCase 
27   
28   
29  from lib.mathematics import order_of_magnitude, round_to_next_order 
30   
31   
33      """Unit tests for the lib.mathematics relax module.""" 
34   
36          """0th test of the lib.mathematics.order_of_magnitude function.""" 
37   
38          self.assertEqual(order_of_magnitude(0.123), 0.0) 
 39   
40   
42          """1st test of the lib.mathematics.order_of_magnitude function.""" 
43   
44          self.assertEqual(order_of_magnitude(1.1), 1.0) 
 45   
46   
48          """2nd test of the lib.mathematics.order_of_magnitude function.""" 
49   
50          self.assertEqual(order_of_magnitude(12), 2.0) 
 51   
52   
54          """3rd test of the lib.mathematics.order_of_magnitude function.""" 
55   
56          self.assertEqual(order_of_magnitude(123), 3.0) 
 57   
58   
60          """4th test of the lib.mathematics.order_of_magnitude function.""" 
61   
62          self.assertEqual(order_of_magnitude(1234), 4.0) 
 63   
64   
66          """0th test of the lib.mathematics.round_to_next_order function.""" 
67   
68          self.assertEqual(round_to_next_order(0.123), 1.0) 
 69   
70   
72          """1st test of the lib.mathematics.round_to_next_order function.""" 
73   
74          self.assertEqual(round_to_next_order(1.1), 10.0) 
 75   
76   
78          """2nd test of the lib.mathematics.round_to_next_order function.""" 
79   
80          self.assertEqual(round_to_next_order(12), 100.0) 
 81   
82   
84          """3rd test of the lib.mathematics.round_to_next_order function.""" 
85   
86          self.assertEqual(round_to_next_order(123), 1000.0) 
 87   
88   
90          """4th test of the lib.mathematics.round_to_next_order function.""" 
91   
92          self.assertEqual(round_to_next_order(1234), 10000.0) 
  93