Пример #1
0
def test_init_bug():
    """ test the init function for bugs"""
    myArr = [1, 2, 3]
    q1 = OurQueue(myArr)
    myArr[0] = -1
    res = q1.front()
    assert res == -1
Пример #2
0
class TestQueue1(unittest.TestCase):
    def setUp(self):
        self.q1 = OurQueue()

    def test_front_empty(self):
        """Q1: test calling front on empty queue"""
        res = self.q1.front()
        self.assertEqual(res, None,
                         "calling front from empty Queue should return None")
Пример #3
0
def test_front_empty():
    """Q1: test calling front on empty queue"""
    q1 = OurQueue()
    res = q1.front()
    assert res == None
Пример #4
0
def test_front_size1():
    """Q6: test front of full queue"""
    q1 = OurQueue([3])
    assert q1.front() == 3
Пример #5
0
def test_add_empty():
    """Q5: test adding item to empty queue"""
    q1 = OurQueue()
    q1.add(1)
    assert len(q1) == 1
    assert q1.front() == 1
Пример #6
0
def test_front():
    """Q6: test front()"""
    q1 = OurQueue()
    q1.add(5)
    assert q1.front() == 5