def test_push_back(self): dq = LinkedDeque() dq.push_back('A') assert dq.length() == 1 assert dq.front() == 'A' dq.push_back('B') assert dq.length() == 2 assert dq.front() == 'A' dq.push_back('C') assert dq.length() == 3 assert dq.front() == 'A' assert dq.is_empty() == False
def test_pop_back(self): dq = LinkedDeque(['A', 'B', 'C']) assert dq.length() == 3 assert dq.front() == 'A' dq.pop_back() assert dq.length() == 2 assert dq.front() == 'A' dq.pop_back() assert dq.length() == 1 assert dq.front() == 'A' assert dq.is_empty() == False dq.pop_back() assert dq.length() == 0 assert dq.front() == None assert dq.is_empty() == True
def test_push_back(self): q = LinkedDeque() q.push_back("A") assert q.length() == 1 q.push_back("B") assert q.length() == 2 assert q.front() == "A" assert q.back() == "B"
def test_init(self): dq = LinkedDeque() assert dq.front() is None assert dq.length() == 0 assert dq.is_empty() is True
def test_init_with_list(self): dq = LinkedDeque(['A', 'B', 'C']) assert dq.front() == 'A' assert dq.length() == 3 assert dq.is_empty() is False
def test_front(self): q = LinkedDeque() assert q.front() is None