summaryrefslogtreecommitdiff
path: root/tests/properties
diff options
context:
space:
mode:
authordjango-bot <ops@djangoproject.com>2022-02-03 20:24:19 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-07 20:37:05 +0100
commit9c19aff7c7561e3a82978a272ecdaad40dda5c00 (patch)
treef0506b668a013d0063e5fba3dbf4863b466713ba /tests/properties
parentf68fa8b45dfac545cfc4111d4e52804c86db68d3 (diff)
downloaddjango-9c19aff7c7561e3a82978a272ecdaad40dda5c00.tar.gz
Refs #33476 -- Reformatted code with Black.
Diffstat (limited to 'tests/properties')
-rw-r--r--tests/properties/models.py2
-rw-r--r--tests/properties/tests.py13
2 files changed, 7 insertions, 8 deletions
diff --git a/tests/properties/models.py b/tests/properties/models.py
index 913c9edf00..c5b75c7d31 100644
--- a/tests/properties/models.py
+++ b/tests/properties/models.py
@@ -15,7 +15,7 @@ class Person(models.Model):
return "%s %s" % (self.first_name, self.last_name)
def _set_full_name(self, combined_name):
- self.first_name, self.last_name = combined_name.split(' ', 1)
+ self.first_name, self.last_name = combined_name.split(" ", 1)
full_name = property(_get_full_name)
diff --git a/tests/properties/tests.py b/tests/properties/tests.py
index dd7a6287d6..da51934d8c 100644
--- a/tests/properties/tests.py
+++ b/tests/properties/tests.py
@@ -4,24 +4,23 @@ from .models import Person
class PropertyTests(TestCase):
-
@classmethod
def setUpTestData(cls):
- cls.a = Person.objects.create(first_name='John', last_name='Lennon')
+ cls.a = Person.objects.create(first_name="John", last_name="Lennon")
def test_getter(self):
- self.assertEqual(self.a.full_name, 'John Lennon')
+ self.assertEqual(self.a.full_name, "John Lennon")
def test_setter(self):
# The "full_name" property hasn't provided a "set" method.
with self.assertRaises(AttributeError):
- setattr(self.a, 'full_name', 'Paul McCartney')
+ setattr(self.a, "full_name", "Paul McCartney")
# And cannot be used to initialize the class.
with self.assertRaises(AttributeError):
- Person(full_name='Paul McCartney')
+ Person(full_name="Paul McCartney")
# But "full_name_2" has, and it can be used to initialize the class.
- a2 = Person(full_name_2='Paul McCartney')
+ a2 = Person(full_name_2="Paul McCartney")
a2.save()
- self.assertEqual(a2.first_name, 'Paul')
+ self.assertEqual(a2.first_name, "Paul")