code: def test_server_registration(self):
      # This test makes sure PyPIRCCommand knows how to:
      # 1. handle several sections in .pypirc
      # 2. handle the old format
  
      # new format
      self.write_file(self.rc, PYPIRC)
      cmd = self._cmd(self.dist)
      config = cmd._read_pypirc()
  
      config = config.items()
      config.sort()
      waited = [
          ("password", "secret"),
          ("realm", "pypi"),
          ("repository", "https://upload.pypi.org/legacy/"),
          ("server", "server1"),
          ("username", "me"),
      ]
      self.assertEqual(config, waited)
  
      # old format
      self.write_file(self.rc, PYPIRC_OLD)
      config = cmd._read_pypirc()
      config = config.items()
      config.sort()
      waited = [
          ("password", "secret"),
          ("realm", "pypi"),
          ("repository", "https://upload.pypi.org/legacy/"),
          ("server", "server-login"),
          ("username", "tarek"),
      ]
      self.assertEqual(config, waited)
  
imports: import sys
  import os
  import unittest
  import tempfile
  import shutil
  from distutils.core import PyPIRCCommand
  from distutils.core import Distribution
  from distutils.log import set_threshold
  from distutils.log import WARN
  from distutils.tests import support
  from test.test_support import run_unittest
label_desc: Use image node_id 3 for calling the PyPIRCCommandTestCase obj's underlying member method code with example usage: obj.test_server_registration() without return types