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