Exemplo n.º 1
0
    def testSwitchableBecomesResolved(self):
        with scopedVat(testingVat()):
            p, r = makePromise()
            self.assertFalse(isResolved(p))

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

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