summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_tree.py
AgeCommit message (Collapse)Author
2022-07-27Refs #32948 -- Renamed Node._new_instance() to Node.create().Nick Pope
Node._new_instance() was added in 6dd2b5468fa275d53aa60fdcaff8c28bdc5e9c25 to work around Q.__init__() having an incompatible signature with Node.__init__(). It was intended as a hook that could be overridden if subclasses needed to change the behaviour of instantiation of their specialised form of Node. In practice this doesn't ever seem to have been used for this purpose and there are very few calls to Node._new_instance() with other code, e.g. Node.__deepcopy__() calling Node and overriding __class__ as required. Rename this to Node.create() to make it a more "official" piece of private API that we can use to simplify a lot of other areas internally. The docstring and nearby comment have been reworded to read more clearly.
2022-07-27Refs #32948 -- Added more tests for django.utils.tree.Node.Nick Pope
The tests for creating new instances or copying instances of Node and its subclasses didn't fully capture the behaviour of the implementation, particularly around whether the `children` list or is contents were the same as the source.
2022-07-27Used AND, OR, XOR constants instead of hard-coded values.Nick Pope
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-05-13Fixed #32717 -- Fixed filtering of querysets combined with the | operator.Simon Charette
Address a long standing bug in a Where.add optimization to discard equal nodes that was surfaced by implementing equality for Lookup instances in bbf141bcdc31f1324048af9233583a523ac54c94. Thanks Shaheed Haque for the report.
2018-10-17Fixed #29838 -- Fixed crash when combining Q objects with __in lookups and ↵aspalding
lists. Regression in fc6528b25ab1834be1a478b405bf8f7ec5cf860c.
2018-08-08Fixed #29643 -- Fixed crash when combining Q objects with __in lookups and ↵Mariusz Felisiak
lists. Regression in fc6528b25ab1834be1a478b405bf8f7ec5cf860c.
2017-09-28Fixed #28629 -- Made tree.Node instances hashable.Mariusz Felisiak
Regression in 508b5debfb16843a8443ebac82c1fb91f15da687 which added Node.__eq__().
2017-02-23Refs #11964 -- Made Q objects deconstructible.Ian Foote
2014-05-16Fixed #22531 -- Added tree.Node.__repr__ and tests for the class.Moayad Mardini
While Node class has a useful `__str__`, its `__repr__` is not that useful. Added a `__repr__` that makes use of the current `__str__`. This is especially useful since the more popular `Q` class inherits `tree.Node`. Also created new tests that cover most of `Node` class functionality.