mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Refs #36500 -- Rewrapped long docstrings and block comments via a script.
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
This commit is contained in:
@@ -66,7 +66,8 @@ class OneToOneTests(TestCase):
|
||||
self.assertEqual(repr(r.place), "<Place: Demon Dogs the place>")
|
||||
|
||||
def test_manager_all(self):
|
||||
# Restaurant.objects.all() just returns the Restaurants, not the Places.
|
||||
# Restaurant.objects.all() just returns the Restaurants, not the
|
||||
# Places.
|
||||
self.assertSequenceEqual(Restaurant.objects.all(), [self.r1])
|
||||
# Place.objects.all() returns all Places, regardless of whether they
|
||||
# have Restaurants.
|
||||
@@ -265,9 +266,10 @@ class OneToOneTests(TestCase):
|
||||
del p._state.fields_cache["restaurant"]
|
||||
self.assertIsNot(p.restaurant, r)
|
||||
|
||||
# Reassigning the Restaurant object results in an immediate cache update
|
||||
# We can't use a new Restaurant because that'll violate one-to-one, but
|
||||
# with a new *instance* the is test below will fail if #6886 regresses.
|
||||
# Reassigning the Restaurant object results in an immediate cache
|
||||
# update We can't use a new Restaurant because that'll violate
|
||||
# one-to-one, but with a new *instance* the is test below will fail if
|
||||
# #6886 regresses.
|
||||
r2 = Restaurant.objects.get(pk=r.pk)
|
||||
p.restaurant = r2
|
||||
self.assertIs(p.restaurant, r2)
|
||||
@@ -298,8 +300,8 @@ class OneToOneTests(TestCase):
|
||||
r = Restaurant(place=p)
|
||||
self.assertIs(r.place, p)
|
||||
|
||||
# Creation using attname keyword argument and an id will cause the related
|
||||
# object to be fetched.
|
||||
# Creation using attname keyword argument and an id will cause the
|
||||
# related object to be fetched.
|
||||
p = Place.objects.get(name="Demon Dogs")
|
||||
r = Restaurant(place_id=p.id)
|
||||
self.assertIsNot(r.place, p)
|
||||
@@ -483,10 +485,12 @@ class OneToOneTests(TestCase):
|
||||
private_school = School.objects.create(is_public=False)
|
||||
private_director = Director.objects.create(school=private_school, is_temp=True)
|
||||
|
||||
# Only one school is available via all() due to the custom default manager.
|
||||
# Only one school is available via all() due to the custom default
|
||||
# manager.
|
||||
self.assertSequenceEqual(School.objects.all(), [public_school])
|
||||
|
||||
# Only one director is available via all() due to the custom default manager.
|
||||
# Only one director is available via all() due to the custom default
|
||||
# manager.
|
||||
self.assertSequenceEqual(Director.objects.all(), [public_director])
|
||||
|
||||
self.assertEqual(public_director.school, public_school)
|
||||
@@ -497,9 +501,9 @@ class OneToOneTests(TestCase):
|
||||
# allow it.
|
||||
self.assertEqual(private_director.school, private_school)
|
||||
|
||||
# Make sure the base manager is used so that an student can still access
|
||||
# its related school even if the default manager doesn't normally
|
||||
# allow it.
|
||||
# Make sure the base manager is used so that an student can still
|
||||
# access its related school even if the default manager doesn't
|
||||
# normally allow it.
|
||||
self.assertEqual(private_school.director, private_director)
|
||||
|
||||
School._meta.base_manager_name = "objects"
|
||||
|
||||
Reference in New Issue
Block a user