summaryrefslogtreecommitdiff
path: root/tests/basic/tests.py
Commit message (Collapse)AuthorAgeFilesLines
* Fixed #470 -- Added support for database defaults on fields.Ian Foote2023-05-121-0/+6
| | | | | | | | Special thanks to Hannes Ljungberg for finding multiple implementation gaps. Thanks also to Simon Charette, Adam Johnson, and Mariusz Felisiak for reviews.
* Refs #33476 -- Applied Black's 2023 stable style.David Smith2023-02-011-1/+0
| | | | | | | | Black 23.1.0 is released which, as the first release of the year, introduces the 2023 stable style. This incorporates most of last year's preview style. https://github.com/psf/black/releases/tag/23.1.0
* Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to ↵Gregor Gärtner2022-10-081-1/+1
| | | | | | assertQuerySetEqual(). Co-Authored-By: Michael Howitz <mh@gocept.com>
* Fixed #23353 -- Used "raise from" when raising TransactionManagementError.David Wobrock2022-10-031-1/+2
| | | | This change sets the __cause__ attribute to raised exceptions.
* Fixed #33733 -- Preserved wrapper assignment for manager methods.kshivakumar2022-06-011-0/+8
|
* Refs #33733 -- Added tests for attributes of manager methods.Mariusz Felisiak2022-06-011-0/+4
|
* Fixed #33646 -- Added async-compatible interface to QuerySet.Andrew Godwin2022-04-261-0/+18
| | | | | | | Thanks Simon Charette for reviews. Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
* Removed redundant QuerySet.all() calls in docs and tests.Nick Pope2022-02-221-3/+3
| | | | Most QuerySet methods are mapped onto the Manager and, in general, it isn't necessary to call .all() on the manager.
* Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak2022-02-071-1/+4
|
* Refs #33476 -- Reformatted code with Black.django-bot2022-02-071-183/+268
|
* Improved Model.__init__() properties loop.Adam Johnson2022-01-131-1/+11
| | | | | This improves readability, accumulates unrecognized arguments raise an exception with all of them, and avoids refetching the values.
* Fixed #24141 -- Added QuerySet.contains().Johan Schiff2021-03-061-0/+1
|
* Fixed #22640 -- Raised TypeError when instantiating model with keyword and ↵Jacob Walls2021-03-011-0/+9
| | | | positional args for the same field.
* Fixed #31235 -- Made assertQuerysetEqual() compare querysets directly.Hasan Ramezani2020-11-061-19/+17
| | | | | | | | 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>
* Fixed #27719 -- Added QuerySet.alias() to allow creating reusable aliases.Alexandr Tatarinov2020-07-311-0/+1
| | | | | | | | QuerySet.alias() allows creating reusable aliases for expressions that don't need to be selected but are used for filtering, ordering, or as a part of complex expressions. Thanks Simon Charette for reviews.
* Fixed #29129 -- Skipped UPDATE when adding a model instance with inherited ↵Abhijeet Viswa2020-03-051-2/+8
| | | | primary key that has a default.
* Simplified imports from django.db and django.contrib.gis.db.Nick Pope2020-02-041-4/+4
|
* Fixed #30651 -- Made __eq__() methods return NotImplemented for not ↵ElizabethU2019-10-011-0/+2
| | | | | | | | | implemented comparisons. Changed __eq__ to return NotImplemented instead of False if compared to an object of the same type, as is recommended by the Python data model reference. Now these models can be compared to ANY (or other objects with __eq__ overwritten) without returning False automatically.
* Fixed #29260 -- Skipped an UPDATE when adding a model instance with primary ↵Hasan Ramezani2019-08-191-1/+9
| | | | key that has a default.
* Fixed #6785 -- Made QuerySet.get() fetch a limited number of rows.Amir Hadi2019-05-121-1/+21
| | | | | | Co-authored-by: Tim Graham <timograham@gmail.com> Co-authored-by: Patryk Zawadzki <patrys@room-303.com> Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
* Refs #30254 -- Added tests for Model.__hash__() inheritance.Carlton Gibson2019-04-241-1/+18
|
* Switched setUp() to setUpTestData() where possible in Django's tests.Simon Charette2018-11-271-3/+4
|
* Added a test for a lookup in Model.refresh_from_db(fields=[...]).Hasan Ramezani2018-11-151-0/+6
|
* Used QuerySet.bulk_create() in a couple tests.oliver2018-11-061-26/+10
|
* Fixed #23646 -- Added QuerySet.bulk_update() to efficiently update many models.Tom Forbes2018-09-181-0/+1
|
* Fixed #29625 -- Made Model.refresh_from_db() clear prefetch related caches.Ming Qin2018-08-201-0/+24
|
* Fixed #29517 -- Rephrased error message when passing incorrect kwarg to ↵Federico Bond2018-06-251-1/+1
| | | | model constructor
* Fixed #28574 -- Added QuerySet.explain().Tom2018-04-191-0/+1
|
* Fixed #29076 -- Made Model.refresh_from_db() clear cached relationships even ↵Jon Dufresne2018-01-301-0/+12
| | | | if the related id doesn't change.
* Fixed #27846 -- Made Model.refresh_from_db() clear cached relations.Paulo2017-10-121-1/+12
|
* Removed DatabaseFeatures.supports_microsecond_precision.Tim Graham2017-09-251-39/+5
| | | | MySQL 5.5 (refs #28552) was the last database to use it.
* Used assertRaisesMessage() to test Django's error messages.Mads Jensen2017-07-291-7/+13
|
* Fixed #28249 -- Removed unnecessary dict.keys() calls.Jon Dufresne2017-05-271-1/+1
| | | iter(dict) is equivalent to iter(dict.keys()).
* Converted usage of ugettext* functions to their gettext* aliasesClaude Paroz2017-02-071-4/+4
| | | | Thanks Tim Graham for the review.
* Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand2017-01-251-1/+1
|
* Refs #23919 -- Removed encoding preambles and future importsClaude Paroz2017-01-181-2/+0
|
* Fixed #27718 -- Added QuerySet.union(), intersection(), difference().Florian Apolloner2017-01-141-0/+3
| | | | Thanks Mariusz Felisiak for review and Oracle assistance. Thanks Tim Graham for review and writing docs.
* Moved test_field_ordering to the model_fields package.Morgan Aubert2016-12-141-17/+0
|
* Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings.za2016-11-101-4/+3
|
* Fixed #26787 -- Documented deleting and reloading of model instance fields.Tim Graham2016-06-211-0/+13
| | | | Thanks Julien Hartmann for the report.
* Fixed #26747 -- Used more specific assertions in the Django test suite.Jon Dufresne2016-06-161-2/+2
|
* Fixed #26620 -- Made Model.refresh_from_db() fail when passed unknown kwargs.Marti Raudsepp2016-05-181-0/+5
|
* Fixed #10506, #13793, #14891, #25201 -- Introduced new APIs to specify ↵Loïc Bistuer2016-05-171-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fixed E128 flake8 warnings in tests/.Tim Graham2016-04-081-20/+19
|
* Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as ↵Hasan2016-01-291-55/+20
| | | | appropriate.
* Refs #26022 -- Used context manager version of assertRaises in tests.Hasan2016-01-291-6/+2
|
* Fixed #26026 -- Fixed isinstance crash comparing EmptyQuerySet to non-QuerySet.Anderson Resende2016-01-071-0/+1
|
* Fixed #25715 -- Fixed Model.refresh_from_db() with ForeignKey ↵Tim Graham2015-11-211-0/+11
| | | | w/on_delete=SET_NULL.
* Refs #21414 -- Removed Field.related per deprecation timeline.Tim Graham2015-09-231-15/+0
|
* Tweak some examples.Aymeric Augustin2015-08-221-13/+13
| | | | | "Area man/woman" is confusing to people not familiar with the conventions of American journalism (like me).