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

            r.resolve(IntObject(42))
            self.assertTrue(isResolved(p))
예제 #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)
예제 #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)
예제 #4
0
    def testSwitchableBecomesResolved(self):
        with scopedVat(testingVat()):
            p, r = makePromise()
            self.assertFalse(isResolved(p))

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