예제 #1
0
def test_mlazy():
    it = iter(range(20, 30))
    p = mlazy(nextfun(it))
    assert p() == 20
    assert p.evaluated
    assert p() == 20
    assert repr(p) == '20'
예제 #2
0
    def test_is_memoized(self):

        it = iter(range(20, 30))
        p = mlazy(nextfun(it))
        self.assertEqual(p(), 20)
        self.assertTrue(p.evaluated)
        self.assertEqual(p(), 20)
        self.assertEqual(repr(p), '20')
예제 #3
0
    def test_is_memoized(self):

        it = iter(range(20, 30))
        p = mlazy(nextfun(it))
        self.assertEqual(p(), 20)
        self.assertTrue(p.evaluated)
        self.assertEqual(p(), 20)
        self.assertEqual(repr(p), '20')
예제 #4
0
 def expand_annotation(annotation):
     if isinstance(annotation, dict):
         return MapAnnotation(annotation)
     elif isinstance(annotation, string_t):
         return mlazy(instantiate, annotation)
     return annotation
예제 #5
0
 def expand_route(route):
     if isinstance(route, dict):
         return MapRoute(route)
     if isinstance(route, string_t):
         return mlazy(instantiate, route)
     return route
예제 #6
0
 def expand_route(route):
     if isinstance(route, dict):
         return MapRoute(route)
     if isinstance(route, string_t):
         return mlazy(instantiate, route)
     return route
예제 #7
0
 def expand_route(route):
     if isinstance(route, (Mapping, list, tuple)):
         return MapRoute(route)
     if isinstance(route, string_t):
         return mlazy(expand_router_string, route)
     return route
예제 #8
0
 def expand_annotation(annotation):
     if isinstance(annotation, dict):
         return MapAnnotation(annotation)
     elif isinstance(annotation, string_t):
         return mlazy(instantiate, annotation)
     return annotation
예제 #9
0
 def expand_route(route):
     if isinstance(route, (Mapping, list, tuple)):
         return MapRoute(route)
     if isinstance(route, string_t):
         return mlazy(expand_router_string, route)
     return route