From f9ec777a826816e20e68021c0e73b5a76be650af Mon Sep 17 00:00:00 2001 From: Theo Alexiou Date: Sat, 5 Feb 2022 20:28:09 +0100 Subject: Fixed #26287 -- Added support for addition operations to SimpleLazyObject. --- tests/utils_tests/test_lazyobject.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/utils_tests/test_lazyobject.py') diff --git a/tests/utils_tests/test_lazyobject.py b/tests/utils_tests/test_lazyobject.py index 9ccae595f4..0ff15469d4 100644 --- a/tests/utils_tests/test_lazyobject.py +++ b/tests/utils_tests/test_lazyobject.py @@ -317,6 +317,17 @@ class SimpleLazyObjectTestCase(LazyObjectTestCase): self.assertIsInstance(obj._wrapped, int) self.assertEqual(repr(obj), "") + def test_add(self): + obj1 = self.lazy_wrap(1) + self.assertEqual(obj1 + 1, 2) + obj2 = self.lazy_wrap(2) + self.assertEqual(obj2 + obj1, 3) + self.assertEqual(obj1 + obj2, 3) + + def test_radd(self): + obj1 = self.lazy_wrap(1) + self.assertEqual(1 + obj1, 2) + def test_trace(self): # See ticket #19456 old_trace_func = sys.gettrace() -- cgit v1.3