From 52d2a8b3119479246225f7f888c370320cf8622f Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Wed, 29 May 2013 17:52:17 +0100 Subject: [PATCH] Add test for new __ne__ method on Promise. --- tests/utils_tests/test_functional.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/utils_tests/test_functional.py b/tests/utils_tests/test_functional.py index 3bb50007c6..fc2256a1f2 100644 --- a/tests/utils_tests/test_functional.py +++ b/tests/utils_tests/test_functional.py @@ -64,3 +64,15 @@ class FunctionalTestCase(unittest.TestCase): # check that it behaves like a property when there's no instance self.assertIsInstance(A.value, cached_property) + + def test_lazy_equality(self): + """ + Tests that == and != work correctly for Promises. + """ + + lazy_a = lazy(lambda: 4, int) + lazy_b = lazy(lambda: 4, int) + lazy_c = lazy(lambda: 5, int) + + self.assertEqual(lazy_a(), lazy_b()) + self.assertNotEqual(lazy_b(), lazy_c())