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()
def test_put_nowait(self): # Arrange queue = Queue() # Act queue.put_nowait("A") # Assert self.assertEqual(1, queue.qsize()) self.assertFalse(queue.empty())
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())
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)
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()
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())
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())