mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Renamed camelCaseTestMethods to snake_case_test_methods
This commit is contained in:
		| @@ -15,7 +15,7 @@ class LoginRequiredTestCase(AuthViewsTestCase): | ||||
|     Tests the login_required decorators | ||||
|     """ | ||||
|  | ||||
|     def testCallable(self): | ||||
|     def test_callable(self): | ||||
|         """ | ||||
|         login_required is assignable to callable objects. | ||||
|         """ | ||||
| @@ -24,7 +24,7 @@ class LoginRequiredTestCase(AuthViewsTestCase): | ||||
|                 pass | ||||
|         login_required(CallableView()) | ||||
|  | ||||
|     def testView(self): | ||||
|     def test_view(self): | ||||
|         """ | ||||
|         login_required is assignable to normal views. | ||||
|         """ | ||||
| @@ -32,7 +32,7 @@ class LoginRequiredTestCase(AuthViewsTestCase): | ||||
|             pass | ||||
|         login_required(normal_view) | ||||
|  | ||||
|     def testLoginRequired(self, view_url='/login_required/', login_url=None): | ||||
|     def test_login_required(self, view_url='/login_required/', login_url=None): | ||||
|         """ | ||||
|         login_required works on a simple view wrapped in a login_required | ||||
|         decorator. | ||||
| @@ -46,12 +46,12 @@ class LoginRequiredTestCase(AuthViewsTestCase): | ||||
|         response = self.client.get(view_url) | ||||
|         self.assertEqual(response.status_code, 200) | ||||
|  | ||||
|     def testLoginRequiredNextUrl(self): | ||||
|     def test_login_required_next_url(self): | ||||
|         """ | ||||
|         login_required works on a simple view wrapped in a login_required | ||||
|         decorator with a login_url set. | ||||
|         """ | ||||
|         self.testLoginRequired(view_url='/login_required_login_url/', login_url='/somewhere/') | ||||
|         self.test_login_required(view_url='/login_required_login_url/', login_url='/somewhere/') | ||||
|  | ||||
|  | ||||
| class PermissionsRequiredDecoratorTest(TestCase): | ||||
|   | ||||
							
								
								
									
										4
									
								
								tests/fixtures/tests.py
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								tests/fixtures/tests.py
									
									
									
									
										vendored
									
									
								
							| @@ -25,7 +25,7 @@ from .models import ( | ||||
| class TestCaseFixtureLoadingTests(TestCase): | ||||
|     fixtures = ['fixture1.json', 'fixture2.json'] | ||||
|  | ||||
|     def testClassFixtures(self): | ||||
|     def test_class_fixtures(self): | ||||
|         "Test case has installed 3 fixture objects" | ||||
|         self.assertEqual(Article.objects.count(), 3) | ||||
|         self.assertQuerysetEqual(Article.objects.all(), [ | ||||
| @@ -41,7 +41,7 @@ class SubclassTestCaseFixtureLoadingTests(TestCaseFixtureLoadingTests): | ||||
|     """ | ||||
|     fixtures = [] | ||||
|  | ||||
|     def testClassFixtures(self): | ||||
|     def test_class_fixtures(self): | ||||
|         "There were no fixture objects installed" | ||||
|         self.assertEqual(Article.objects.count(), 0) | ||||
|  | ||||
|   | ||||
| @@ -8,7 +8,7 @@ from .models import Article | ||||
| class SampleTestCase(TestCase): | ||||
|     fixtures = ['fixture1.json', 'fixture2.json'] | ||||
|  | ||||
|     def testClassFixtures(self): | ||||
|     def test_class_fixtures(self): | ||||
|         "Test cases can load fixture objects into models defined in packages" | ||||
|         self.assertEqual(Article.objects.count(), 3) | ||||
|         self.assertQuerysetEqual( | ||||
|   | ||||
| @@ -136,7 +136,7 @@ class GenericInlineAdminParametersTest(TestDataMixin, TestCase): | ||||
|         self.assertEqual(formset.total_form_count(), 1) | ||||
|         self.assertEqual(formset.initial_form_count(), 1) | ||||
|  | ||||
|     def testMaxNumParam(self): | ||||
|     def test_max_num_param(self): | ||||
|         """ | ||||
|         With extra=5 and max_num=2, there should be only 2 forms. | ||||
|         """ | ||||
|   | ||||
| @@ -11,7 +11,7 @@ from django.contrib.gis.measure import A, Area, D, Distance | ||||
| class DistanceTest(unittest.TestCase): | ||||
|     "Testing the Distance object" | ||||
|  | ||||
|     def testInit(self): | ||||
|     def test_init(self): | ||||
|         "Testing initialization from valid units" | ||||
|         d = Distance(m=100) | ||||
|         self.assertEqual(d.m, 100) | ||||
| @@ -32,23 +32,23 @@ class DistanceTest(unittest.TestCase): | ||||
|             self.assertEqual(d.m, 1.0) | ||||
|             self.assertEqual(d.mm, 1000.0) | ||||
|  | ||||
|     def testInitInvalid(self): | ||||
|     def test_init_invalid(self): | ||||
|         "Testing initialization from invalid units" | ||||
|         with self.assertRaises(AttributeError): | ||||
|             D(banana=100) | ||||
|  | ||||
|     def testAccess(self): | ||||
|     def test_access(self): | ||||
|         "Testing access in different units" | ||||
|         d = D(m=100) | ||||
|         self.assertEqual(d.km, 0.1) | ||||
|         self.assertAlmostEqual(d.ft, 328.084, 3) | ||||
|  | ||||
|     def testAccessInvalid(self): | ||||
|     def test_access_invalid(self): | ||||
|         "Testing access in invalid units" | ||||
|         d = D(m=100) | ||||
|         self.assertFalse(hasattr(d, 'banana')) | ||||
|  | ||||
|     def testAddition(self): | ||||
|     def test_addition(self): | ||||
|         "Test addition & subtraction" | ||||
|         d1 = D(m=100) | ||||
|         d2 = D(m=200) | ||||
| @@ -75,7 +75,7 @@ class DistanceTest(unittest.TestCase): | ||||
|         with self.assertRaises(TypeError): | ||||
|             d1 -= 1 | ||||
|  | ||||
|     def testMultiplication(self): | ||||
|     def test_multiplication(self): | ||||
|         "Test multiplication & division" | ||||
|         d1 = D(m=100) | ||||
|  | ||||
| @@ -103,7 +103,7 @@ class DistanceTest(unittest.TestCase): | ||||
|         with self.assertRaises(TypeError): | ||||
|             d1 /= D(m=1) | ||||
|  | ||||
|     def testUnitConversions(self): | ||||
|     def test_unit_conversions(self): | ||||
|         "Testing default units during maths" | ||||
|         d1 = D(m=100) | ||||
|         d2 = D(km=1) | ||||
| @@ -117,7 +117,7 @@ class DistanceTest(unittest.TestCase): | ||||
|         d6 = d1 / 2 | ||||
|         self.assertEqual(d6._default_unit, 'm') | ||||
|  | ||||
|     def testComparisons(self): | ||||
|     def test_comparisons(self): | ||||
|         "Testing comparisons" | ||||
|         d1 = D(m=100) | ||||
|         d2 = D(km=1) | ||||
| @@ -128,7 +128,7 @@ class DistanceTest(unittest.TestCase): | ||||
|         self.assertLess(d1, d2) | ||||
|         self.assertFalse(d3) | ||||
|  | ||||
|     def testUnitsStr(self): | ||||
|     def test_units_str(self): | ||||
|         "Testing conversion to strings" | ||||
|         d1 = D(m=100) | ||||
|         d2 = D(km=3.5) | ||||
| @@ -138,7 +138,7 @@ class DistanceTest(unittest.TestCase): | ||||
|         self.assertEqual(repr(d1), 'Distance(m=100.0)') | ||||
|         self.assertEqual(repr(d2), 'Distance(km=3.5)') | ||||
|  | ||||
|     def testUnitAttName(self): | ||||
|     def test_unit_att_name(self): | ||||
|         "Testing the `unit_attname` class method" | ||||
|         unit_tuple = [('Yard', 'yd'), ('Nautical Mile', 'nm'), ('German legal metre', 'german_m'), | ||||
|                       ('Indian yard', 'indian_yd'), ('Chain (Sears)', 'chain_sears'), ('Chain', 'chain')] | ||||
| @@ -150,7 +150,7 @@ class DistanceTest(unittest.TestCase): | ||||
| class AreaTest(unittest.TestCase): | ||||
|     "Testing the Area object" | ||||
|  | ||||
|     def testInit(self): | ||||
|     def test_init(self): | ||||
|         "Testing initialization from valid units" | ||||
|         a = Area(sq_m=100) | ||||
|         self.assertEqual(a.sq_m, 100) | ||||
| @@ -161,23 +161,23 @@ class AreaTest(unittest.TestCase): | ||||
|         a = A(sq_mi=100) | ||||
|         self.assertEqual(a.sq_m, 258998811.0336) | ||||
|  | ||||
|     def testInitInvaliA(self): | ||||
|     def test_init_invalid_a(self): | ||||
|         "Testing initialization from invalid units" | ||||
|         with self.assertRaises(AttributeError): | ||||
|             A(banana=100) | ||||
|  | ||||
|     def testAccess(self): | ||||
|     def test_access(self): | ||||
|         "Testing access in different units" | ||||
|         a = A(sq_m=100) | ||||
|         self.assertEqual(a.sq_km, 0.0001) | ||||
|         self.assertAlmostEqual(a.sq_ft, 1076.391, 3) | ||||
|  | ||||
|     def testAccessInvaliA(self): | ||||
|     def test_access_invalid_a(self): | ||||
|         "Testing access in invalid units" | ||||
|         a = A(sq_m=100) | ||||
|         self.assertFalse(hasattr(a, 'banana')) | ||||
|  | ||||
|     def testAddition(self): | ||||
|     def test_addition(self): | ||||
|         "Test addition & subtraction" | ||||
|         a1 = A(sq_m=100) | ||||
|         a2 = A(sq_m=200) | ||||
| @@ -204,7 +204,7 @@ class AreaTest(unittest.TestCase): | ||||
|         with self.assertRaises(TypeError): | ||||
|             a1 -= 1 | ||||
|  | ||||
|     def testMultiplication(self): | ||||
|     def test_multiplication(self): | ||||
|         "Test multiplication & division" | ||||
|         a1 = A(sq_m=100) | ||||
|  | ||||
| @@ -232,7 +232,7 @@ class AreaTest(unittest.TestCase): | ||||
|         with self.assertRaises(TypeError): | ||||
|             a1 /= A(sq_m=1) | ||||
|  | ||||
|     def testUnitConversions(self): | ||||
|     def test_unit_conversions(self): | ||||
|         "Testing default units during maths" | ||||
|         a1 = A(sq_m=100) | ||||
|         a2 = A(sq_km=1) | ||||
| @@ -246,7 +246,7 @@ class AreaTest(unittest.TestCase): | ||||
|         a6 = a1 / 2 | ||||
|         self.assertEqual(a6._default_unit, 'sq_m') | ||||
|  | ||||
|     def testComparisons(self): | ||||
|     def test_comparisons(self): | ||||
|         "Testing comparisons" | ||||
|         a1 = A(sq_m=100) | ||||
|         a2 = A(sq_km=1) | ||||
| @@ -257,7 +257,7 @@ class AreaTest(unittest.TestCase): | ||||
|         self.assertLess(a1, a2) | ||||
|         self.assertFalse(a3) | ||||
|  | ||||
|     def testUnitsStr(self): | ||||
|     def test_units_str(self): | ||||
|         "Testing conversion to strings" | ||||
|         a1 = A(sq_m=100) | ||||
|         a2 = A(sq_km=3.5) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user