示例#1
0
 def test_publish_no_children(self):
     """
     try_publish_obj() does nothing when there are no children
     """
     block = DummyProcessBlock()
     self.assertTrue(block.try_publish_obj(0))
     self.assertTrue(block.objs.empty())
示例#2
0
    def test_publish_none(self):
        """
        try_publish_obj() does nothing if obj is None
        """
        block = DummyProcessBlock()
        ZombieBlock(parent=block)

        self.assertTrue(block.try_publish_obj(None))
        self.assertTrue(block.objs.empty())
示例#3
0
    def test_publish_interrupted(self):
        """
        try_publish_obj() will fail if an event occurs
        """
        block = DummyProcessBlock()
        ZombieBlock(parent=block)

        block.event.set()
        self.assertFalse(block.try_publish_obj(0))
        self.assertTrue(block.objs.empty())
示例#4
0
    def test_publish_obj(self):
        """
        try_publish_obj() puts a object in the block's queue
        """
        block = DummyProcessBlock()
        # Objects are only stored if there are children
        ZombieBlock(parent=block)

        self.assertTrue(block.try_publish_obj(0))
        self.assertEqual(block.objs.get(timeout=1), 0)