Пример #1
0
 def test_first_results(self):
     from flowy import first
     from flowy.result import result, error, timeout, placeholder
     r = result(1, 1)
     t = timeout(2)
     e = error('err!', 3)
     p = placeholder()
     self.assertEquals(first([e, p, r, t]).__factory__, r.__factory__)
Пример #2
0
 def test_first_results(self):
     from flowy import first
     from flowy.result import result, error, timeout, placeholder
     r = result(1, 1)
     t = timeout(2)
     e = error('err!', 3)
     p = placeholder()
     self.assertEquals(first([e, p, r, t]).__factory__, r.__factory__)
Пример #3
0
 def __call__(self, time_scale=1):
     x1 = self.a(1, sleep=1.0 * time_scale, identity=1)
     x2 = self.a(2, sleep=0.5 * time_scale, identity=2)
     x3 = self.a(3, sleep=1.5 * time_scale, identity=3)
     x4 = self.a(4, sleep=2.0 * time_scale, identity=4)
     return first(x1, x2, x3, x4)
Пример #4
0
 def test_first_non_results(self):
     from flowy import first
     x = [1, 2, 3, 4, 5, 'a', 'b', 'c']
     self.assertEquals(1, first(x))
Пример #5
0
    def test_first_non_results(self):
        from flowy import first

        x = [1, 2, 3, 4, 5, "a", "b", "c"]
        self.assertEquals(1, first(x))
Пример #6
0
 def test_first_non_results(self):
     from flowy import first
     x = [1, 2, 3, 4, 5, 'a', 'b', 'c']
     self.assertEquals(1, first(x))
Пример #7
0
 def __call__(self, time_scale=1):
     x1 = self.a(1, sleep=1.0 * time_scale, identity=1)
     x2 = self.a(2, sleep=0.5 * time_scale, identity=2)
     x3 = self.a(3, sleep=1.5 * time_scale, identity=3)
     x4 = self.a(4, sleep=2.0 * time_scale, identity=4)
     return first(x1, x2, x3, x4)
Пример #8
0
 def __call__(self):
     a = self.task()
     b = self.task()
     return first(a, b)