Commit 52d2a8b3 authored by Andrew Godwin's avatar Andrew Godwin
Browse files

Add test for new __ne__ method on Promise.

parent d0ecefc2
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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())