From 775b796d8d13841059850d73986d5dcc2e593077 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Fri, 12 Mar 2021 09:00:39 +0100 Subject: Refs #32508 -- Raised ValueError instead of using "assert" in lazy(). --- tests/utils_tests/test_functional.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/utils_tests/test_functional.py') diff --git a/tests/utils_tests/test_functional.py b/tests/utils_tests/test_functional.py index 595479a503..b870f98ea2 100644 --- a/tests/utils_tests/test_functional.py +++ b/tests/utils_tests/test_functional.py @@ -224,6 +224,12 @@ class FunctionalTests(SimpleTestCase): lazified() mocked.assert_not_called() + 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() + def test_classproperty_getter(self): class Foo: foo_attr = 123 -- cgit v1.3