Ejemplo n.º 1
0
    def test_after(self):
        m = Mock()
        class Type(): pass

        def make_t(): return Type()

        @requires(first(Type))
        def f_t(t): m.f_t()
        @requires(Type)
        def n_t(t): m.n_t()
        @requires(last(Type))
        def l_t_1(t): m.l_t_1()
        @requires(after(Type))
        def after_t1(): m.after_t1()
        @requires(last(Type))
        def l_t_2(t): m.l_t_2()
        
        Runner(make_t, l_t_1, after_t1, l_t_2, n_t, f_t)()
        
        compare([
                call.f_t(),
                call.n_t(),
                call.l_t_1(),
                call.after_t1(),
                call.l_t_2(),
                ], m.mock_calls)
Ejemplo n.º 2
0
 def test_after(self):
     w = after(Type1)
     compare(repr(w), 'last(ignore(Type1))')
     self.assertTrue(isinstance(w, when))
     h = w.type
     compare(h.type, Type1)
     compare(h.names, ())
     self.assertTrue(isinstance(h, how))