summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_functional.py
AgeCommit message (Collapse)Author
2023-06-12Allowed custom formatting of lazy() objects.Nick Pope
This allows for formatting of lazy objects which have a custom formatter defined by overriding the default implementation from `object`.
2023-06-12Allowed multiplication of lazy() objects with int return type.Nick Pope
2023-06-12Made proxy class in lazy() prepare eagerly.Ran Benita
Previously, the proxy class was prepared lazily: lazy_identity = lazy(identity, int) lazy_identity(10) # prepared here lazy_identity(10) This has a slight advantage that if the lazy doesn't end up getting used, the preparation work is skipped, however that's not very likely. Besides this laziness, it is also inconsistent in that the methods which are wrapped directly (__str__ etc.) are prepared already when __proxy__ is defined, and there is a weird half-initialized state. This change it so that everything is prepared already on the first line of the example above.
2023-06-12Added more tests for django.utils.functional.lazy().Nick Pope
2023-06-08Made bytes and str return types no longer mutually exclusive in lazy().Ran Benita
They are no longer special cased.
2023-06-08Refs #34445 -- Fixed string-casting of non-string lazy objects when value ↵Ran Benita
may be bytes. If the result type is bytes, then calling bytes() on it does nothing. If the result type is not bytes, we should not cast to bytes, just because the return value may be bytes.
2023-05-23Refs #34118 -- Fixed ↵Mariusz Felisiak
FunctionalTests.test_cached_property_reuse_different_names() on Python 3.12+. Python 3.12+ no longer wraps exceptions in __set_name__, see https://github.com/python/cpython/commit/55c99d97e14618dfce41472dd4446f763b0da13f
2023-03-30Fixed #34445 -- Fixed string-casting of non-string lazy objects.Ran Benita
This removes __text_cast() as it's the same as __cast(). _delegate_bytes and __delegate_text are mutually exclusive so the `if self._delegate_bytes` branch in __cast() is unreachable. Co-Authored-By: David Sanders <shang.xiao.sanders@gmail.com>
2023-01-17Refs #30127 -- Removed name argument for ↵Mariusz Felisiak
django.utils.functional.cached_property(). Per deprecation timeline.
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-12-16Fixed #30127 -- Deprecated name argument of cached_property().mgaligniana
2021-03-15Refs #32508 -- Raised ValueError instead of using "assert" in lazy().Hasan Ramezani
2020-12-21Fixed #32208 -- Allowed adding lazy() objects.Hasan Ramezani
Co-authored-by: Claude Paroz <claude@2xlibre.net>
2019-10-21Fixed #30876 -- Moved classproperty() decorator to the django.utils.functional.André Ericson
2019-05-22Fixed #30498 -- Fixed proxy class caching in lazy().Ran Benita
lazy() should prepare the proxy class only once (the first time it's used) not on every call. Regression in b4e76f30d12bfa8a53cc297c60055c6f4629cc4c.
2019-01-30Fixed #30116 -- Dropped support for Python 3.5.Tim Graham
2018-11-19Fixed #29478 -- Added support for mangled names to cached_property.Thomas Grainger
Co-Authored-By: Sergey Fedoseev <fedoseev.sergey@gmail.com>
2017-01-19Refs #23919 -- Stopped inheriting from object to define new style classes.Simon Charette
2017-01-18Refs #23919 -- Removed six.<various>_types usageClaude Paroz
Thanks Tim Graham and Simon Charette for the reviews.
2017-01-18Refs #23919 -- Removed six.PY2/PY3 usageClaude Paroz
Thanks Tim Graham for the review.
2017-01-18Refs #23919 -- Removed encoding preambles and future importsClaude Paroz
2016-11-29Fixed #27555 -- Removed django.utils.functional.lazy_property.Adam Chainz
2016-11-10Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings.za
2016-06-14Removed usage of a few deprecated unittest assertions.Ville Skyttä
2016-06-04Fixed #24781 -- Fixed repr() for lazy objects.Chesco Igual
2016-01-29Refs #26022 -- Used context manager version of assertRaises in tests.Hasan
2015-06-23Fixed #25000 -- Fixed cast to string for lazy objects.Marten Kenbeek
Implemented __str__() to return the string-representation of the proxied object, not the proxy itself, if the lazy object didn't have a string-like object in its resultclasses.
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2014-12-26Fixed #23346 -- Fixed lazy() to lookup methods on the real object, not ↵Gavin Wahl
resultclasses. Co-Authored-By: Rocky Meza <rmeza@fusionbox.com>
2014-11-03Fixed #23620 -- Used more specific assertions in the Django test suite.Berker Peksag
2014-10-20Fixed #23688 -- Updated cached_property to preserve docstring of original ↵John-Scott Atlakson
function
2014-07-01Fixed #22691 -- Added aliasing to cached_property.Curtis
2013-10-23Fixed #21298 -- Fixed E301 pep8 warningsAlasdair Nicol
2013-07-02Merge branch 'master' into schema-alterationAndrew Godwin
2013-07-01Stopped using django.utils.unittest in the test suite.Aymeric Augustin
Refs #20680.
2013-05-29Add test for new __ne__ method on Promise.Andrew Godwin
2013-04-12Modified utils_tests for unittest2 discovery.Preston Timmons