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_pop_back(self): q = LinkedDeque() with self.assertRaises(ValueError): q.pop_back() q.push_front("A") assert q.length() == 1 assert q.pop_back() == "A" assert q.is_empty() is True q.push_back("two") q.push_front("one") assert q.pop_back() == "two" assert q.pop_back() == "one" with self.assertRaises(ValueError): q.pop_back() assert q.is_empty() is True