Skip to content

Commit da0b255

Browse files
committed
Renamed camelCaseTestMethods to snake_case_test_methods
1 parent 2e38f20 commit da0b255

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

tests/auth_tests/test_decorators.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class LoginRequiredTestCase(AuthViewsTestCase):
1515
Tests the login_required decorators
1616
"""
1717

18-
def testCallable(self):
18+
def test_callable(self):
1919
"""
2020
login_required is assignable to callable objects.
2121
"""
@@ -24,15 +24,15 @@ def __call__(self, *args, **kwargs):
2424
pass
2525
login_required(CallableView())
2626

27-
def testView(self):
27+
def test_view(self):
2828
"""
2929
login_required is assignable to normal views.
3030
"""
3131
def normal_view(request):
3232
pass
3333
login_required(normal_view)
3434

35-
def testLoginRequired(self, view_url='/login_required/', login_url=None):
35+
def test_login_required(self, view_url='/login_required/', login_url=None):
3636
"""
3737
login_required works on a simple view wrapped in a login_required
3838
decorator.
@@ -46,12 +46,12 @@ def testLoginRequired(self, view_url='/login_required/', login_url=None):
4646
response = self.client.get(view_url)
4747
self.assertEqual(response.status_code, 200)
4848

49-
def testLoginRequiredNextUrl(self):
49+
def test_login_required_next_url(self):
5050
"""
5151
login_required works on a simple view wrapped in a login_required
5252
decorator with a login_url set.
5353
"""
54-
self.testLoginRequired(view_url='/login_required_login_url/', login_url='/somewhere/')
54+
self.test_login_required(view_url='/login_required_login_url/', login_url='/somewhere/')
5555

5656

5757
class PermissionsRequiredDecoratorTest(TestCase):

tests/fixtures/tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
class TestCaseFixtureLoadingTests(TestCase):
2626
fixtures = ['fixture1.json', 'fixture2.json']
2727

28-
def testClassFixtures(self):
28+
def test_class_fixtures(self):
2929
"Test case has installed 3 fixture objects"
3030
self.assertEqual(Article.objects.count(), 3)
3131
self.assertQuerysetEqual(Article.objects.all(), [
@@ -41,7 +41,7 @@ class SubclassTestCaseFixtureLoadingTests(TestCaseFixtureLoadingTests):
4141
"""
4242
fixtures = []
4343

44-
def testClassFixtures(self):
44+
def test_class_fixtures(self):
4545
"There were no fixture objects installed"
4646
self.assertEqual(Article.objects.count(), 0)
4747

tests/fixtures_model_package/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class SampleTestCase(TestCase):
99
fixtures = ['fixture1.json', 'fixture2.json']
1010

11-
def testClassFixtures(self):
11+
def test_class_fixtures(self):
1212
"Test cases can load fixture objects into models defined in packages"
1313
self.assertEqual(Article.objects.count(), 3)
1414
self.assertQuerysetEqual(

tests/generic_inline_admin/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class ExtraInline(GenericTabularInline):
136136
self.assertEqual(formset.total_form_count(), 1)
137137
self.assertEqual(formset.initial_form_count(), 1)
138138

139-
def testMaxNumParam(self):
139+
def test_max_num_param(self):
140140
"""
141141
With extra=5 and max_num=2, there should be only 2 forms.
142142
"""

tests/gis_tests/test_measure.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class 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):
150150
class 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

Comments
 (0)