diff options
author | Ran Benita <ran234@gmail.com> | 2019-05-03 12:58:12 +0300 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-03-30 11:42:10 +0200 |
commit | 066aabcb77579cf8d549119c860d11cd15e3eef1 (patch) | |
tree | 127b7e01ff529c6670bbcf57b0645a2f4e70b0fc /tests/utils_tests | |
parent | 0a132de7ebe1e2679ff7d7f6b6e1ad920828dd90 (diff) | |
download | django-066aabcb77579cf8d549119c860d11cd15e3eef1.tar.gz |
Fixed #34445 -- Fixed string-casting of non-string lazy objects.
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>
Diffstat (limited to 'tests/utils_tests')
-rw-r--r-- | tests/utils_tests/test_functional.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/utils_tests/test_functional.py b/tests/utils_tests/test_functional.py index 23e2eaddcd..f1cc751bdd 100644 --- a/tests/utils_tests/test_functional.py +++ b/tests/utils_tests/test_functional.py @@ -233,6 +233,10 @@ class FunctionalTests(SimpleTestCase): with self.assertRaisesMessage(ValueError, msg): lazy_obj() + def test_lazy_str_cast_mixed_result_types(self): + lazy_value = lazy(lambda: [1], str, list)() + self.assertEqual(str(lazy_value), "[1]") + def test_classproperty_getter(self): class Foo: foo_attr = 123 |