mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Refs #33476 -- Reformatted code with Black.
This commit is contained in:
committed by
Mariusz Felisiak
parent
f68fa8b45d
commit
9c19aff7c7
@@ -11,28 +11,29 @@ def test_mutation(raises=True):
|
||||
output_field = models.IntegerField()
|
||||
|
||||
def __init__(self):
|
||||
self.attribute = 'initial'
|
||||
super().__init__('initial', ['initial'])
|
||||
self.attribute = "initial"
|
||||
super().__init__("initial", ["initial"])
|
||||
|
||||
def as_sql(self, *args, **kwargs):
|
||||
mutation_func(self)
|
||||
return '', ()
|
||||
return "", ()
|
||||
|
||||
if raises:
|
||||
msg = 'TestFunc Func was mutated during compilation.'
|
||||
msg = "TestFunc Func was mutated during compilation."
|
||||
with test_case_instance.assertRaisesMessage(AssertionError, msg):
|
||||
getattr(TestFunc(), 'as_' + connection.vendor)(None, None)
|
||||
getattr(TestFunc(), "as_" + connection.vendor)(None, None)
|
||||
else:
|
||||
getattr(TestFunc(), 'as_' + connection.vendor)(None, None)
|
||||
getattr(TestFunc(), "as_" + connection.vendor)(None, None)
|
||||
|
||||
return test
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
class FuncTestMixinTests(FuncTestMixin, SimpleTestCase):
|
||||
@test_mutation()
|
||||
def test_mutated_attribute(func):
|
||||
func.attribute = 'mutated'
|
||||
func.attribute = "mutated"
|
||||
|
||||
@test_mutation()
|
||||
def test_mutated_expressions(func):
|
||||
@@ -40,11 +41,11 @@ class FuncTestMixinTests(FuncTestMixin, SimpleTestCase):
|
||||
|
||||
@test_mutation()
|
||||
def test_mutated_expression(func):
|
||||
func.source_expressions[0].name = 'mutated'
|
||||
func.source_expressions[0].name = "mutated"
|
||||
|
||||
@test_mutation()
|
||||
def test_mutated_expression_deep(func):
|
||||
func.source_expressions[1].value[0] = 'mutated'
|
||||
func.source_expressions[1].value[0] = "mutated"
|
||||
|
||||
@test_mutation(raises=False)
|
||||
def test_not_mutated(func):
|
||||
|
||||
Reference in New Issue
Block a user