diff options
| author | Ran Benita <ran234@gmail.com> | 2019-05-03 13:12:54 +0300 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-06-08 06:38:11 +0200 |
| commit | f5817c24f44aa90188757ddca1e5e63ba6f5df75 (patch) | |
| tree | 304f8df84d43d3ad233ee51112991e63a75ccb3a /tests/utils_tests/test_functional.py | |
| parent | 5f2308710b5a3d9f5f135b7ade08214f5c154ec4 (diff) | |
Refs #34445 -- Fixed string-casting of non-string lazy objects when value 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.
Diffstat (limited to 'tests/utils_tests/test_functional.py')
| -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 f8763b3db6..cc4409d893 100644 --- a/tests/utils_tests/test_functional.py +++ b/tests/utils_tests/test_functional.py @@ -242,6 +242,10 @@ class FunctionalTests(SimpleTestCase): lazy_value = lazy(lambda: [1], str, list)() self.assertEqual(str(lazy_value), "[1]") + def test_lazy_str_cast_mixed_bytes_result_types(self): + lazy_value = lazy(lambda: [1], bytes, list)() + self.assertEqual(str(lazy_value), "[1]") + def test_classproperty_getter(self): class Foo: foo_attr = 123 |
