old_contents: import unittest
  
  from .. import heroku
  
  
  class HerokuTest(unittest.TestCase):
  
      @unittest.skip('not implmemented')
      def test_port(self):
          # The port number comes from the PORT environment variable.
          # XXX implement
          ...
new_contents: import os
  import random
  import unittest
  
  from .. import heroku
  
  
  class HerokuTest(unittest.TestCase):
  
      def test_port(self):
          # The port number comes from the PORT environment variable.
          old_port = os.environ.get('PORT')
          def reset_port():
              if old_port is None:
                  del os.environ['PORT']
              else:
                  os.environ['PORT'] = old_port
          port = random.randint(1, 2**16 - 1)
          os.environ['PORT'] = str(port)
          self.addCleanup(reset_port)
          server = heroku.Host()
          self.assertEqual(server.port(), port)
subject: Test Heroku.Host.port()