コード例 #1
0
 def test_peek_front_rear(self):
     d = Dequeue()
     d.add_front("apple")
     d.add_front("banana")
     d.add_front("cherry")
     self.assertEqual(d.items, ["cherry", "banana", "apple"])
     self.assertEqual(d.peek_front(), "cherry")
     self.assertEqual(d.peek_rear(), "apple")
コード例 #2
0
 def test_peek_empty(self):
     d = Dequeue()
     self.assertEqual(d.peek_front(), None)
     self.assertEqual(d.peek_rear(), None)