def test_queue_instantiation(self):
        # Arrange
        queue = Queue()

        # Act, Assert
        assert queue.maxsize == 0
        assert queue.qsize() == 0
        assert queue.empty()
        assert not queue.full()
    def test_put_nowait(self):
        # Arrange
        queue = Queue()

        # Act
        queue.put_nowait("A")

        # Assert
        assert queue.qsize() == 1
        assert not queue.empty()
Пример #3
0
    def test_put_nowait(self):
        # Arrange
        queue = Queue()

        # Act
        queue.put_nowait("A")

        # Assert
        self.assertEqual(1, queue.qsize())
        self.assertFalse(queue.empty())
Пример #4
0
    def test_queue_instantiation(self):
        # Arrange
        queue = Queue()

        # Act
        # Assert
        self.assertEqual(0, queue.maxsize)
        self.assertEqual(0, queue.qsize())
        self.assertTrue(queue.empty())
        self.assertFalse(queue.full())
Пример #5
0
    def test_get_nowait(self):
        # Arrange
        queue = Queue()
        queue.put_nowait("A")

        # Act
        item = queue.get_nowait()

        # Assert
        self.assertEqual(0, queue.qsize())
        self.assertEqual("A", item)
Пример #6
0
        async def run_test():
            # Arrange
            queue = Queue()
            queue.put_nowait("A")

            # Act
            item = await queue.get()

            # Assert
            self.assertEqual(0, queue.qsize())
            self.assertEqual("A", item)
    def test_put_to_maxlen_makes_queue_full(self):
        # Arrange
        queue = Queue(maxsize=5)

        # Act
        queue.put_nowait("A")
        queue.put_nowait("B")
        queue.put_nowait("C")
        queue.put_nowait("D")
        queue.put_nowait("E")

        # Assert
        assert queue.qsize() == 5
        assert queue.full()
    def test_put_nowait_multiple_items(self):
        # Arrange
        queue = Queue()

        # Act
        queue.put_nowait("A")
        queue.put_nowait("B")
        queue.put_nowait("C")
        queue.put_nowait("D")
        queue.put_nowait("E")

        # Assert
        assert queue.qsize() == 5
        assert not queue.empty()
Пример #9
0
    def test_put_to_maxlen_makes_queue_full(self):
        # Arrange
        queue = Queue(maxsize=5)

        # Act
        queue.put_nowait("A")
        queue.put_nowait("B")
        queue.put_nowait("C")
        queue.put_nowait("D")
        queue.put_nowait("E")

        # Assert
        self.assertEqual(5, queue.qsize())
        self.assertTrue(queue.full())
Пример #10
0
    def test_put_nowait_multiple_items(self):
        # Arrange
        queue = Queue()

        # Act
        queue.put_nowait("A")
        queue.put_nowait("B")
        queue.put_nowait("C")
        queue.put_nowait("D")
        queue.put_nowait("E")

        # Assert
        self.assertEqual(5, queue.qsize())
        self.assertFalse(queue.empty())