def test_as_list_when_no_items_returns_empty_list(self): # Arrange queue = Queue() # Act result = queue.to_list() # Assert assert result == []
def test_as_list_when_items_returns_expected_list(self): # Arrange queue = Queue() queue.put_nowait("A") queue.put_nowait("B") queue.put_nowait("C") # Act result = queue.to_list() # Assert assert result == ["C", "B", "A"] assert queue.get_nowait() == "A" assert result == ["C", "B", "A"] # <-- confirm was copy