diff --git a/django/utils/functional.py b/django/utils/functional.py index be5fac23ad..66d88d9b59 100644 --- a/django/utils/functional.py +++ b/django/utils/functional.py @@ -119,13 +119,6 @@ def lazy(func, *resultclasses): continue meth = cls.__promise__(method_name) setattr(cls, method_name, meth) - cls._delegate_bytes = bytes in resultclasses - cls._delegate_text = str in resultclasses - if cls._delegate_bytes and cls._delegate_text: - raise ValueError( - "Cannot call lazy() with both bytes and text return types." - ) - @classmethod def __promise__(cls, method_name): diff --git a/tests/utils_tests/test_functional.py b/tests/utils_tests/test_functional.py index cc4409d893..9a5cbfe068 100644 --- a/tests/utils_tests/test_functional.py +++ b/tests/utils_tests/test_functional.py @@ -234,9 +234,7 @@ class FunctionalTests(SimpleTestCase): def test_lazy_bytes_and_str_result_classes(self): lazy_obj = lazy(lambda: "test", str, bytes) - msg = "Cannot call lazy() with both bytes and text return types." - with self.assertRaisesMessage(ValueError, msg): - lazy_obj() + self.assertEqual(str(lazy_obj()), "test") def test_lazy_str_cast_mixed_result_types(self): lazy_value = lazy(lambda: [1], str, list)()