summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_lazyobject.py
diff options
context:
space:
mode:
authorTheo Alexiou <theofilosalexiou@gmail.com>2022-02-05 20:28:09 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-10 11:24:51 +0100
commitf9ec777a826816e20e68021c0e73b5a76be650af (patch)
tree5c1eba3d3fad3e32361d44a8c6fff1559a1c11b9 /tests/utils_tests/test_lazyobject.py
parent4c76ffc2d6c77c850b4bef8d9acc197d11c47937 (diff)
Fixed #26287 -- Added support for addition operations to SimpleLazyObject.
Diffstat (limited to 'tests/utils_tests/test_lazyobject.py')
-rw-r--r--tests/utils_tests/test_lazyobject.py11
1 files changed, 11 insertions, 0 deletions
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), "<SimpleLazyObject: 42>")
+ 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()