Example #1
0
    def testSwitchableBecomesResolved(self):
        with scopedVat(testingVat()):
            p, r = makePromise()
            self.assertFalse(isResolved(p))

            r.resolve(IntObject(42))
            self.assertTrue(isResolved(p))
Example #2
0
 def testRefEqualitySettled(self):
     with scopedVat(testingVat()):
         first, r = makePromise()
         r.resolve(IntObject(42))
         second, r = makePromise()
         r.resolve(IntObject(42))
         self.assertEqual(optSame(first, second), EQUAL)
Example #3
0
 def testRefEqualitySettled(self):
     with scopedVat(testingVat()):
         first, r = makePromise()
         r.resolve(IntObject(42))
         second, r = makePromise()
         r.resolve(IntObject(42))
         self.assertEqual(optSame(first, second), EQUAL)
Example #4
0
    def testSwitchableBecomesResolved(self):
        with scopedVat(testingVat()):
            p, r = makePromise()
            self.assertFalse(isResolved(p))

            r.resolve(IntObject(42))
            self.assertTrue(isResolved(p))
Example #5
0
    def testSwitchableChains(self):
        with scopedVat(testingVat()):
            p, r = makePromise()
            p2, r2 = makePromise()

            r.resolve(p2)
            self.assertFalse(isResolved(p))

            r2.resolve(IntObject(42))
            self.assertTrue(isResolved(p))
Example #6
0
    def testSwitchableChains(self):
        with scopedVat(testingVat()):
            p, r = makePromise()
            p2, r2 = makePromise()

            r.resolve(p2)
            self.assertFalse(isResolved(p))

            r2.resolve(IntObject(42))
            self.assertTrue(isResolved(p))
Example #7
0
 def testPromise(self):
     with scopedVat(testingVat()):
         p, r = makePromise()
         self.assertFalse(isSettled(p))
Example #8
0
 def testUnwrapListPromise(self):
     with scopedVat(testingVat()):
         p = makeNear(wrapList([]))
         self.assertEqual(unwrapList(p), [])
Example #9
0
 def testUnwrapMapPromise(self):
     with scopedVat(testingVat()):
         p = makeNear(ConstMap({}))
         self.assertEqual(unwrapMap(p).items(), [])
Example #10
0
 def testUnwrapBoolPromise(self):
     with scopedVat(testingVat()):
         p = makeNear(wrapBool(False))
         self.assertFalse(unwrapBool(p))
Example #11
0
 def testUnwrapIntPromise(self):
     with scopedVat(testingVat()):
         p = makeNear(IntObject(42))
         self.assertEqual(unwrapInt(p), 42)
Example #12
0
 def testUnwrapListPromise(self):
     with scopedVat(testingVat()):
         p = makeNear(ConstList([]))
         self.assertEqual(unwrapList(p), [])
Example #13
0
 def testRefEquality(self):
     with scopedVat(testingVat()):
         first, r = makePromise()
         second, r = makePromise()
         self.assertEqual(optSame(first, second), NOTYET)
Example #14
0
 def testResolveNear(self):
     with scopedVat(testingVat()):
         p = makeNear(wrapBool(False))
         self.assertFalse(resolution(p).isTrue())
Example #15
0
 def testUnwrapBoolPromise(self):
     with scopedVat(testingVat()):
         p = makeNear(wrapBool(False))
         self.assertFalse(unwrapBool(p))
Example #16
0
 def testPromiseResolved(self):
     with scopedVat(testingVat()):
         p, r = makePromise()
         r.resolve(IntObject(42))
         self.assertTrue(p.isSettled())
Example #17
0
 def testPromise(self):
     with scopedVat(testingVat()):
         p, r = makePromise()
         self.assertFalse(p.isSettled())
Example #18
0
 def testPromiseResolved(self):
     with scopedVat(testingVat()):
         p, r = makePromise()
         r.resolve(IntObject(42))
         self.assertTrue(isSettled(p))
Example #19
0
 def testRefEquality(self):
     with scopedVat(testingVat()):
         first, r = makePromise()
         second, r = makePromise()
         self.assertEqual(optSame(first, second), NOTYET)
Example #20
0
 def testRefEqualityReflexive(self):
     with scopedVat(testingVat()):
         p, r = makePromise()
         self.assertEqual(optSame(p, p), EQUAL)
Example #21
0
 def testPromoteToDoublePromise(self):
     with scopedVat(testingVat()):
         p = makeNear(DoubleObject(4.2))
         self.assertAlmostEqual(promoteToDouble(p), 4.2)
Example #22
0
 def testResolveNear(self):
     with scopedVat(testingVat()):
         p = makeNear(wrapBool(False))
         self.assertFalse(resolution(p).isTrue())
Example #23
0
 def testUnwrapIntPromise(self):
     with scopedVat(testingVat()):
         p = makeNear(IntObject(42))
         self.assertEqual(unwrapInt(p), 42)
Example #24
0
 def testPromoteToDoublePromise(self):
     with scopedVat(testingVat()):
         p = makeNear(DoubleObject(4.2))
         self.assertAlmostEqual(promoteToDouble(p), 4.2)
Example #25
0
 def testUnwrapMapPromise(self):
     with scopedVat(testingVat()):
         p = makeNear(ConstMap({}))
         self.assertEqual(unwrapMap(p).items(), [])
Example #26
0
 def testRefEqualityReflexive(self):
     with scopedVat(testingVat()):
         p, r = makePromise()
         self.assertEqual(optSame(p, p), EQUAL)