old_contents: import unittest
  
  from linked_list import LinkedList
  
  
  class LinkedListTest(unittest.TestCase):
      def setUp(self):
          self.list = LinkedList()
  
      def test_push_pop(self):
          self.list.push(10)
          self.list.push(20)
          self.assertEqual(self.list.pop(), 20)
          self.assertEqual(self.list.pop(), 10)
  
      def test_push_shift(self):
          self.list.push(10)
          self.list.push(20)
          self.assertEqual(self.list.shift(), 10)
          self.assertEqual(self.list.shift(), 20)
  
      def test_unshift_shift(self):
          self.list.unshift(10)
          self.list.unshift(20)
          self.assertEqual(self.list.shift(), 20)
          self.assertEqual(self.list.shift(), 10)
  
      def test_unshift_pop(self):
          self.list.unshift(10)
          self.list.unshift(20)
          self.assertEqual(self.list.pop(), 10)
          self.assertEqual(self.list.pop(), 20)
  
      def test_all(self):
          self.list.push(10)
          self.list.push(20)
          self.assertEqual(self.list.pop(), 20)
          self.list.push(30)
          self.assertEqual(self.list.shift(), 10)
          self.list.unshift(40)
          self.list.push(50)
          self.assertEqual(self.list.shift(), 40)
          self.assertEqual(self.list.pop(), 50)
          self.assertEqual(self.list.shift(), 30)
  
      @unittest.skip("extra-credit")
      def test_length(self):
          self.list.push(10)
          self.list.push(20)
          self.assertEqual(len(self.list), 2)
          self.list.shift()
          self.assertEqual(len(self.list), 1)
          self.list.pop()
          self.assertEqual(len(self.list), 0)
  
      @unittest.skip("extra-credit")
      def test_iterator(self):
          self.list.push(10)
          self.list.push(20)
          iterator = iter(self.list)
          self.assertEqual(next(iterator), 10)
          self.assertEqual(next(iterator), 20)
  
  
  if __name__ == '__main__':
      unittest.main()
  
new_contents: import unittest
  
  from linked_list import LinkedList
  
  
  class LinkedListTest(unittest.TestCase):
      def test_push_pop(self):
          lst = LinkedList()
          lst.push(10)
          lst.push(20)
          self.assertEqual(lst.pop(), 20)
          self.assertEqual(lst.pop(), 10)
  
      def test_push_shift(self):
          lst = LinkedList()
          lst.push(10)
          lst.push(20)
          self.assertEqual(lst.shift(), 10)
          self.assertEqual(lst.shift(), 20)
  
      def test_unshift_shift(self):
          lst = LinkedList()
          lst.unshift(10)
          lst.unshift(20)
          self.assertEqual(lst.shift(), 20)
          self.assertEqual(lst.shift(), 10)
  
      def test_unshift_pop(self):
          lst = LinkedList()
          lst.unshift(10)
          lst.unshift(20)
          self.assertEqual(lst.pop(), 10)
          self.assertEqual(lst.pop(), 20)
  
      def test_all(self):
          lst = LinkedList()
          lst.push(10)
          lst.push(20)
          self.assertEqual(lst.pop(), 20)
          lst.push(30)
          self.assertEqual(lst.shift(), 10)
          lst.unshift(40)
          lst.push(50)
          self.assertEqual(lst.shift(), 40)
          self.assertEqual(lst.pop(), 50)
          self.assertEqual(lst.shift(), 30)
  
      @unittest.skip("extra-credit")
      def test_length(self):
          lst = LinkedList()
          lst.push(10)
          lst.push(20)
          self.assertEqual(len(lst), 2)
          lst.shift()
          self.assertEqual(len(lst), 1)
          lst.pop()
          self.assertEqual(len(lst), 0)
  
      @unittest.skip("extra-credit")
      def test_iterator(self):
          lst = LinkedList()
          lst.push(10)
          lst.push(20)
          iterator = iter(lst)
          self.assertEqual(next(iterator), 10)
          self.assertEqual(next(iterator), 20)
  
  
  if __name__ == '__main__':
      unittest.main()
  
subject: use new instance of LinkedList for each test (#1414)