예제 #1
0
파일: test_hub.py 프로젝트: NotSqrt/celery
 def test_repr_events(self):
     hub = Hub()
     hub.readers = {6: Mock(), 7: Mock(), 8: Mock()}
     hub.writers = {9: Mock()}
     for value in list(hub.readers.values()) + list(hub.writers.values()):
         value.__name__ = "mock"
     self.assertTrue(hub.repr_events([(6, READ), (7, ERR), (8, READ | ERR), (9, WRITE), (10, 13213)]))
예제 #2
0
파일: test_hub.py 프로젝트: NotSqrt/celery
 def test_repr_active(self):
     hub = Hub()
     hub.readers = {1: Mock(), 2: Mock()}
     hub.writers = {3: Mock(), 4: Mock()}
     for value in list(hub.readers.values()) + list(hub.writers.values()):
         value.__name__ = "mock"
     self.assertTrue(hub.repr_active())
예제 #3
0
파일: test_hub.py 프로젝트: xenouch/celery
 def test_repr_active(self):
     hub = Hub()
     hub.readers = {1: Mock(), 2: Mock()}
     hub.writers = {3: Mock(), 4: Mock()}
     for value in list(hub.readers.values()) + list(hub.writers.values()):
         value.__name__ = 'mock'
     self.assertTrue(hub.repr_active())
예제 #4
0
파일: test_hub.py 프로젝트: NotSqrt/celery
    def test_callback_for(self):
        hub = Hub()
        reader, writer = Mock(), Mock()
        hub.readers = {6: reader}
        hub.writers = {7: writer}

        self.assertEqual(hub._callback_for(6, READ), reader)
        self.assertEqual(hub._callback_for(7, WRITE), writer)
        with self.assertRaises(KeyError):
            hub._callback_for(6, WRITE)
        self.assertEqual(hub._callback_for(6, WRITE, "foo"), "foo")
예제 #5
0
파일: test_hub.py 프로젝트: xenouch/celery
    def test_callback_for(self):
        hub = Hub()
        reader, writer = Mock(), Mock()
        hub.readers = {6: reader}
        hub.writers = {7: writer}

        self.assertEqual(callback_for(hub, 6, READ), reader)
        self.assertEqual(callback_for(hub, 7, WRITE), writer)
        with self.assertRaises(KeyError):
            callback_for(hub, 6, WRITE)
        self.assertEqual(callback_for(hub, 6, WRITE, 'foo'), 'foo')
예제 #6
0
 def test_repr_events(self):
     hub = Hub()
     hub.readers = {6: Mock(), 7: Mock(), 8: Mock()}
     hub.writers = {9: Mock()}
     for value in list(hub.readers.values()) + list(hub.writers.values()):
         value.__name__ = 'mock'
     self.assertTrue(hub.repr_events([
         (6, READ),
         (7, ERR),
         (8, READ | ERR),
         (9, WRITE),
         (10, 13213),
     ]))