1111class DistanceTest (unittest .TestCase ):
1212 "Testing the Distance object"
1313
14- def testInit (self ):
14+ def test_init (self ):
1515 "Testing initialization from valid units"
1616 d = Distance (m = 100 )
1717 self .assertEqual (d .m , 100 )
@@ -32,23 +32,23 @@ def testInit(self):
3232 self .assertEqual (d .m , 1.0 )
3333 self .assertEqual (d .mm , 1000.0 )
3434
35- def testInitInvalid (self ):
35+ def test_init_invalid (self ):
3636 "Testing initialization from invalid units"
3737 with self .assertRaises (AttributeError ):
3838 D (banana = 100 )
3939
40- def testAccess (self ):
40+ def test_access (self ):
4141 "Testing access in different units"
4242 d = D (m = 100 )
4343 self .assertEqual (d .km , 0.1 )
4444 self .assertAlmostEqual (d .ft , 328.084 , 3 )
4545
46- def testAccessInvalid (self ):
46+ def test_access_invalid (self ):
4747 "Testing access in invalid units"
4848 d = D (m = 100 )
4949 self .assertFalse (hasattr (d , 'banana' ))
5050
51- def testAddition (self ):
51+ def test_addition (self ):
5252 "Test addition & subtraction"
5353 d1 = D (m = 100 )
5454 d2 = D (m = 200 )
@@ -75,7 +75,7 @@ def testAddition(self):
7575 with self .assertRaises (TypeError ):
7676 d1 -= 1
7777
78- def testMultiplication (self ):
78+ def test_multiplication (self ):
7979 "Test multiplication & division"
8080 d1 = D (m = 100 )
8181
@@ -103,7 +103,7 @@ def testMultiplication(self):
103103 with self .assertRaises (TypeError ):
104104 d1 /= D (m = 1 )
105105
106- def testUnitConversions (self ):
106+ def test_unit_conversions (self ):
107107 "Testing default units during maths"
108108 d1 = D (m = 100 )
109109 d2 = D (km = 1 )
@@ -117,7 +117,7 @@ def testUnitConversions(self):
117117 d6 = d1 / 2
118118 self .assertEqual (d6 ._default_unit , 'm' )
119119
120- def testComparisons (self ):
120+ def test_comparisons (self ):
121121 "Testing comparisons"
122122 d1 = D (m = 100 )
123123 d2 = D (km = 1 )
@@ -128,7 +128,7 @@ def testComparisons(self):
128128 self .assertLess (d1 , d2 )
129129 self .assertFalse (d3 )
130130
131- def testUnitsStr (self ):
131+ def test_units_str (self ):
132132 "Testing conversion to strings"
133133 d1 = D (m = 100 )
134134 d2 = D (km = 3.5 )
@@ -138,7 +138,7 @@ def testUnitsStr(self):
138138 self .assertEqual (repr (d1 ), 'Distance(m=100.0)' )
139139 self .assertEqual (repr (d2 ), 'Distance(km=3.5)' )
140140
141- def testUnitAttName (self ):
141+ def test_unit_att_name (self ):
142142 "Testing the `unit_attname` class method"
143143 unit_tuple = [('Yard' , 'yd' ), ('Nautical Mile' , 'nm' ), ('German legal metre' , 'german_m' ),
144144 ('Indian yard' , 'indian_yd' ), ('Chain (Sears)' , 'chain_sears' ), ('Chain' , 'chain' )]
@@ -150,7 +150,7 @@ def testUnitAttName(self):
150150class AreaTest (unittest .TestCase ):
151151 "Testing the Area object"
152152
153- def testInit (self ):
153+ def test_init (self ):
154154 "Testing initialization from valid units"
155155 a = Area (sq_m = 100 )
156156 self .assertEqual (a .sq_m , 100 )
@@ -161,23 +161,23 @@ def testInit(self):
161161 a = A (sq_mi = 100 )
162162 self .assertEqual (a .sq_m , 258998811.0336 )
163163
164- def testInitInvaliA (self ):
164+ def test_init_invalid_a (self ):
165165 "Testing initialization from invalid units"
166166 with self .assertRaises (AttributeError ):
167167 A (banana = 100 )
168168
169- def testAccess (self ):
169+ def test_access (self ):
170170 "Testing access in different units"
171171 a = A (sq_m = 100 )
172172 self .assertEqual (a .sq_km , 0.0001 )
173173 self .assertAlmostEqual (a .sq_ft , 1076.391 , 3 )
174174
175- def testAccessInvaliA (self ):
175+ def test_access_invalid_a (self ):
176176 "Testing access in invalid units"
177177 a = A (sq_m = 100 )
178178 self .assertFalse (hasattr (a , 'banana' ))
179179
180- def testAddition (self ):
180+ def test_addition (self ):
181181 "Test addition & subtraction"
182182 a1 = A (sq_m = 100 )
183183 a2 = A (sq_m = 200 )
@@ -204,7 +204,7 @@ def testAddition(self):
204204 with self .assertRaises (TypeError ):
205205 a1 -= 1
206206
207- def testMultiplication (self ):
207+ def test_multiplication (self ):
208208 "Test multiplication & division"
209209 a1 = A (sq_m = 100 )
210210
@@ -232,7 +232,7 @@ def testMultiplication(self):
232232 with self .assertRaises (TypeError ):
233233 a1 /= A (sq_m = 1 )
234234
235- def testUnitConversions (self ):
235+ def test_unit_conversions (self ):
236236 "Testing default units during maths"
237237 a1 = A (sq_m = 100 )
238238 a2 = A (sq_km = 1 )
@@ -246,7 +246,7 @@ def testUnitConversions(self):
246246 a6 = a1 / 2
247247 self .assertEqual (a6 ._default_unit , 'sq_m' )
248248
249- def testComparisons (self ):
249+ def test_comparisons (self ):
250250 "Testing comparisons"
251251 a1 = A (sq_m = 100 )
252252 a2 = A (sq_km = 1 )
@@ -257,7 +257,7 @@ def testComparisons(self):
257257 self .assertLess (a1 , a2 )
258258 self .assertFalse (a3 )
259259
260- def testUnitsStr (self ):
260+ def test_units_str (self ):
261261 "Testing conversion to strings"
262262 a1 = A (sq_m = 100 )
263263 a2 = A (sq_km = 3.5 )
0 commit comments