Made miscellaneous code cleanups
This commit is contained in:
parent
a05d86a69a
commit
ca32979cdc
|
@ -560,7 +560,7 @@ class BaseCacheTests(object):
|
||||||
# Count how many keys are left in the cache.
|
# Count how many keys are left in the cache.
|
||||||
for i in range(1, initial_count):
|
for i in range(1, initial_count):
|
||||||
if cull_cache.has_key('cull%d' % i):
|
if cull_cache.has_key('cull%d' % i):
|
||||||
count = count + 1
|
count += 1
|
||||||
self.assertEqual(count, final_count)
|
self.assertEqual(count, final_count)
|
||||||
|
|
||||||
def test_cull(self):
|
def test_cull(self):
|
||||||
|
|
|
@ -1316,10 +1316,10 @@ class TestIsBoundBehavior(SimpleTestCase):
|
||||||
unbound_formset = ArticleFormSet()
|
unbound_formset = ArticleFormSet()
|
||||||
bound_formset = ArticleFormSet(data)
|
bound_formset = ArticleFormSet(data)
|
||||||
|
|
||||||
empty_forms = []
|
empty_forms = [
|
||||||
|
unbound_formset.empty_form,
|
||||||
empty_forms.append(unbound_formset.empty_form)
|
bound_formset.empty_form
|
||||||
empty_forms.append(bound_formset.empty_form)
|
]
|
||||||
|
|
||||||
# Empty forms should be unbound
|
# Empty forms should be unbound
|
||||||
self.assertFalse(empty_forms[0].is_bound)
|
self.assertFalse(empty_forms[0].is_bound)
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Receiver(object):
|
||||||
signal.connect(self, sender=APP_CONFIG)
|
signal.connect(self, sender=APP_CONFIG)
|
||||||
|
|
||||||
def __call__(self, signal, sender, **kwargs):
|
def __call__(self, signal, sender, **kwargs):
|
||||||
self.call_counter = self.call_counter + 1
|
self.call_counter += 1
|
||||||
self.call_args = kwargs
|
self.call_args = kwargs
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class OneTimeReceiver(object):
|
||||||
# Although test runner calls migrate for several databases,
|
# Although test runner calls migrate for several databases,
|
||||||
# testing for only one of them is quite sufficient.
|
# testing for only one of them is quite sufficient.
|
||||||
if kwargs['using'] == MIGRATE_DATABASE:
|
if kwargs['using'] == MIGRATE_DATABASE:
|
||||||
self.call_counter = self.call_counter + 1
|
self.call_counter += 1
|
||||||
self.call_args = kwargs
|
self.call_args = kwargs
|
||||||
# we need to test only one call of migrate
|
# we need to test only one call of migrate
|
||||||
self.signal.disconnect(self, sender=APP_CONFIG)
|
self.signal.disconnect(self, sender=APP_CONFIG)
|
||||||
|
|
|
@ -330,11 +330,11 @@ def bisect_tests(bisection_label, options, test_labels, parallel):
|
||||||
|
|
||||||
if failures_a and not failures_b:
|
if failures_a and not failures_b:
|
||||||
print("***** Problem found in first half. Bisecting again...")
|
print("***** Problem found in first half. Bisecting again...")
|
||||||
iteration = iteration + 1
|
iteration += 1
|
||||||
test_labels = test_labels_a[:-1]
|
test_labels = test_labels_a[:-1]
|
||||||
elif failures_b and not failures_a:
|
elif failures_b and not failures_a:
|
||||||
print("***** Problem found in second half. Bisecting again...")
|
print("***** Problem found in second half. Bisecting again...")
|
||||||
iteration = iteration + 1
|
iteration += 1
|
||||||
test_labels = test_labels_b[:-1]
|
test_labels = test_labels_b[:-1]
|
||||||
elif failures_a and failures_b:
|
elif failures_a and failures_b:
|
||||||
print("***** Multiple sources of failure found")
|
print("***** Multiple sources of failure found")
|
||||||
|
|
|
@ -146,7 +146,7 @@ class CommandTests(SimpleTestCase):
|
||||||
self.counter = 0
|
self.counter = 0
|
||||||
|
|
||||||
def patched_check(self_, **kwargs):
|
def patched_check(self_, **kwargs):
|
||||||
self.counter = self.counter + 1
|
self.counter += 1
|
||||||
|
|
||||||
saved_check = BaseCommand.check
|
saved_check = BaseCommand.check
|
||||||
BaseCommand.check = patched_check
|
BaseCommand.check = patched_check
|
||||||
|
|
|
@ -103,8 +103,7 @@ class LazyObjectTestCase(TestCase):
|
||||||
|
|
||||||
def test_hash(self):
|
def test_hash(self):
|
||||||
obj = self.lazy_wrap('foo')
|
obj = self.lazy_wrap('foo')
|
||||||
d = {}
|
d = {obj: 'bar'}
|
||||||
d[obj] = 'bar'
|
|
||||||
self.assertIn('foo', d)
|
self.assertIn('foo', d)
|
||||||
self.assertEqual(d['foo'], 'bar')
|
self.assertEqual(d['foo'], 'bar')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue