summaryrefslogtreecommitdiff
path: root/tests/one_to_one
AgeCommit message (Collapse)Author
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2025-01-15Refs #33651 -- Removed Prefetch.get_current_queryset() and ↵Sarah Boyce
get_prefetch_queryset() per deprecation timeline.
2024-08-28Fixed #35666 -- Documented stacklevel usage and testing, and adjusted test ↵Simon Charette
suite accordingly. Over the years we've had multiple instances of hit and misses when emitting warnings: either setting the wrong stacklevel or not setting it at all. This work adds assertions for the existing warnings that were declaring the correct stacklevel, but were lacking tests for it.
2024-02-19Fixed #35230 -- Added cached ForeignObjectRel.accessor_name.Adam Johnson
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
2023-09-18Fixed #33651 -- Added support for prefetching GenericForeignKey.Clément Escolano
Co-authored-by: revanthgss <revanthgss@almabase.com> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2023-08-09Fixed #34586 -- Made QuerySet.create() raise ValueError for reverse ↵Mariana
one-to-many relations.
2022-02-22Removed redundant QuerySet.all() calls in docs and tests.Nick Pope
Most QuerySet methods are mapped onto the Manager and, in general, it isn't necessary to call .all() on the manager.
2022-02-07Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2020-11-06Fixed #31235 -- Made assertQuerysetEqual() compare querysets directly.Hasan Ramezani
This also replaces assertQuerysetEqual() to assertSequenceEqual()/assertCountEqual() where appropriate. Co-authored-by: Peter Inglesby <peter.inglesby@gmail.com> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-05-15Refs #31395 -- Relied on setUpTestData() test data isolation in various tests.Simon Charette
2020-04-30Removed unused __str__() methods in tests models.Mariusz Felisiak
Follow up to 6461583b6cc257d25880ef9a9fd7e2125ac53ce1.
2019-10-29Used more specific unittest assertions in tests.Nick Pope
* assertIsNone()/assertIsNotNone() instead of comparing to None. * assertLess() for < comparisons. * assertIs() for 'is' expressions. * assertIsInstance() for isinstance() expressions. * rounding of assertAlmostEqual() for round() expressions. * assertIs(..., True/False) instead of comparing to True/False. * assertIs()/assertIsNot() for ==/!= comparisons. * assertNotEqual() for == comparisons. * assertTrue()/assertFalse() instead of comparing to True/False.
2019-07-27Refs #28147 -- Fixed setting of OneToOne and Foreign Key fields to None when ↵Jon Dufresne
using attnames. Regression in 519016e5f25d7c0a040015724f9920581551cab0.
2019-07-27Added tests for using attnames to assign OneToOne and Foreign Key fields.Jon Dufresne
2019-05-24Refs #9982 -- Added test for saving OneToOneField field after saving related ↵Mariusz Felisiak
object. Fixed in 519016e5f25d7c0a040015724f9920581551cab0.
2018-02-12Fixed typo in tests/one_to_one/tests.py docstring.Snow_Poijio
2017-11-09Fixed #27710 -- Made Model.save() invalidate cached, stale relations after a ↵Paulo
primary key assignment.
2017-10-30Fixed #28742 -- Fixed AttributeError crash when assigning None to cached ↵Paulo
reverse relations.
2017-08-10Refs #16043 -- Refactored internal fields value cache.Paulo
* Removed all hardcoded logic for _{fieldname}_cache. * Added an internal API for interacting with the field values cache. Thanks carljm and MarkusH for support.
2017-07-29Used assertRaisesMessage() to test Django's error messages.Mads Jensen
2017-04-10Fixed #28047 -- Fixed QuerySet.filter() crash when it uses the name of a ↵Tim Graham
OneToOneField pk. Regression in 1bc249c2a67c24fcd28436c85388eff1d826e305.
2017-04-10Changed assertQuerysetEqual()s that use default Model.__str__() to ↵Collin Anderson
assertSequenceEqual().
2017-01-25Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand
2017-01-18Refs #23919 -- Removed python_2_unicode_compatible decorator usageClaude Paroz
2017-01-18Refs #23919 -- Removed encoding preambles and future importsClaude Paroz
2017-01-17Removed Manager.use_for_related_fields and Meta.manager_inheritance_from_future.Tim Graham
Per deprecation timeline. Refs ed0ff913c648b16c4471fc9a9441d1ee48cb5420.
2016-11-10Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings.za
2016-09-13Fixed #27203 -- Replaced assertQuerysetEqual(..., lambda o: o) with ↵Mads Jensen
assertSequenceEqual().
2016-06-04Fixed #26667 -- Fixed a regression in queries on a OneToOneField that has ↵Tim Graham
to_field and primary_key=True. Thanks Simon Charette for review.
2016-05-17Fixed #10506, #13793, #14891, #25201 -- Introduced new APIs to specify ↵Loïc Bistuer
models' default and base managers. This deprecates use_for_related_fields. Old API: class CustomManager(models.Model): use_for_related_fields = True class Model(models.Model): custom_manager = CustomManager() New API: class Model(models.Model): custom_manager = CustomManager() class Meta: base_manager_name = 'custom_manager' Refs #20932, #25897. Thanks Carl Meyer for the guidance throughout this work. Thanks Tim Graham for writing the docs.
2016-05-17Fixed #20932, #25897 -- Streamlined manager inheritance.Loïc Bistuer
2016-02-11Fixed #26179 -- Removed null assignment check for non-nullable foreign key ↵ZachLiuGIS
fields.
2016-01-29Refs #26022 -- Used context manager version of assertRaises in tests.Hasan
2015-10-27Fixed #25550 -- Deprecated direct assignment to the reverse side of a ↵Tim Graham
related set.
2015-10-09Fixed #14368 -- Allowed setting a reverse OneToOne relation to None.Tim Graham
2015-09-19Fixed #25296 -- Prevented model related object cache pollution when create() ↵Raphael Merx
fails due to an unsaved object.
2015-09-19Fixed #25160 (again) -- Moved data loss check on reverse relations.Aymeric Augustin
Moved data loss check when assigning to a reverse one-to-one relation on an unsaved instance to Model.save(). This is exactly the same change as e4b813c but for reverse relations.
2015-08-20Fixed #24951 -- Fixed AssertionError in delete queries involving a ↵Tim Graham
foreign/primary key. Thanks Anssi Kääriäinen for help.
2015-08-10Fixed #25160 -- Moved unsaved model instance data loss check to Model.save()Tim Graham
This mostly reverts 5643a3b51be338196d0b292d5626ad43648448d3 and 81e1a35c364e5353d2bf99368ad30a4184fbb653. Thanks Carl Meyer for review.
2015-07-27Fixed #21127 -- Started deprecation toward requiring on_delete for ↵Flavio Curella
ForeignKey/OneToOneField
2015-06-29Fixed #23791 -- Corrected object type check for pk__in=qsAnssi Kääriäinen
When the pk was a relation field, qs.filter(pk__in=qs) didn't work. In addition, fixed Restaurant.objects.filter(place=restaurant_instance), where place is an OneToOneField and the primary key of Restaurant. A big thank you to Josh for review and to Tim for review and cosmetic edits. Thanks to Beauhurst for commissioning the work on this ticket.
2015-04-09Fixed #24578 -- Fixed crash with QuerySet.update() on FK to O2O fields.Tim Graham
Thanks Anssi Kääriäinen for review.
2015-03-25Renamed Field.rel attribute to remote_fieldAnssi Kääriäinen
Field.rel is now deprecated. Rel objects have now also remote_field attribute. This means that self == self.remote_field.remote_field. In addition, made the Rel objects a bit more like Field objects. Still, marked ManyToManyFields as null=True.
2015-03-18Fixed #24495 -- Allowed unsaved model instance assignment check to be bypassed.Karl Hobley
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2014-12-23Fixed #21414 -- Removed RelatedObject and deprecated Field.related.Anssi Kääriäinen
2014-11-25Fixed and restored assertions in OneToOneTests.test_foreign_key.Adam Alton
These assertions had been removed in 34ba86706f and 7fe554b2a3, seemingly because they were referencing the wrong objects, and so they started failing when the checking of object types (as well as PK values) was introduced.
2014-11-03Fixed #23620 -- Used more specific assertions in the Django test suite.Berker Peksag