mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
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>
This commit is contained in:
committed by
Mariusz Felisiak
parent
0a132de7eb
commit
066aabcb77
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user