Exemple #1
0
    def test_add(self):
        add(self.callback, 1)
        eq_(len(_locals.tasks), 1)
        add(self.callback, 1)
        eq_(len(_locals.tasks), 1)
        add(self.callback, 2)
        eq_(len(_locals.tasks), 2)

        callback = mock.Mock()
        callback.__name__ = 'bar'
        add(callback, 2)
        eq_(len(_locals.tasks), 3)
Exemple #2
0
    def test_add(self):
        add(self.callback, 1)
        eq_(len(_locals.tasks), 1)
        add(self.callback, 1)
        eq_(len(_locals.tasks), 1)
        add(self.callback, 2)
        eq_(len(_locals.tasks), 2)

        callback = mock.Mock()
        callback.__name__ = 'bar'
        add(callback, 2)
        eq_(len(_locals.tasks), 3)
Exemple #3
0
 def foo():
     add(self.callback, 1)
Exemple #4
0
 def test_context(self):
     with context.send():
         add(self.callback, 1)
     assert self.callback.called
Exemple #5
0
 def test_process_groups(self):
     add(self.callback, 1)
     add(self.callback, 4)
     process()
     eq_(set(self.callback.call_args[0][0]), set([1, 4]))
Exemple #6
0
 def test_process(self):
     add(self.callback, 1)
     process()
     assert self.callback.called
Exemple #7
0
 def test_reset(self):
     add(self.callback, 1)
     eq_(len(_locals.tasks), 1)
     reset()
     eq_(len(_locals.tasks), 0)
Exemple #8
0
 def foo():
     add(self.callback, 1)
Exemple #9
0
 def test_context(self):
     with context.send():
         add(self.callback, 1)
     assert self.callback.called
Exemple #10
0
 def test_process_groups(self):
     add(self.callback, 1)
     add(self.callback, 4)
     process()
     eq_(set(self.callback.call_args[0][0]), set([1, 4]))
Exemple #11
0
 def test_process(self):
     add(self.callback, 1)
     process()
     assert self.callback.called
Exemple #12
0
 def test_reset(self):
     add(self.callback, 1)
     eq_(len(_locals.tasks), 1)
     reset()
     eq_(len(_locals.tasks), 0)