Add test for new __ne__ method on Promise.

This commit is contained in:
Andrew Godwin 2013-05-29 17:52:17 +01:00
parent d0ecefc2c9
commit 52d2a8b311
1 changed files with 12 additions and 0 deletions

View File

@ -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())