Beispiel #1
0
    def test_is_memoized(self):

        it = iter(range(20, 30))
        p = mpromise(nextfun(it))
        self.assertEqual(p(), 20)
        self.assertTrue(p.evaluated)
        self.assertEqual(p(), 20)
        self.assertEqual(repr(p), '20')
Beispiel #2
0
    def test_is_memoized(self):

        it = iter(xrange(20, 30))
        p = mpromise(it.next)
        self.assertEqual(p(), 20)
        self.assertTrue(p.evaluated)
        self.assertEqual(p(), 20)
        self.assertEqual(repr(p), '20')
Beispiel #3
0
    def test_is_memoized(self):

        it = iter(xrange(20, 30))
        p = mpromise(it.next)
        self.assertEqual(p(), 20)
        self.assertTrue(p.evaluated)
        self.assertEqual(p(), 20)
        self.assertEqual(repr(p), "20")
Beispiel #4
0
 def expand_route(route):
     if isinstance(route, dict):
         return MapRoute(route)
     if isinstance(route, string_t):
         return mpromise(instantiate, route)
     return route
Beispiel #5
0
 def expand_annotation(annotation):
     if isinstance(annotation, dict):
         return MapAnnotation(annotation)
     elif isinstance(annotation, basestring):
         return mpromise(instantiate, annotation)
     return annotation
Beispiel #6
0
 def expand_route(route):
     if isinstance(route, dict):
         return MapRoute(route)
     if isinstance(route, string_t):
         return mpromise(instantiate, route)
     return route