code: def test_try_parse_port_returns_none_if_str_is_invalid(self) -> None:
      port_strs = [
          "",
          "   ",
          "  1",
          "1  ",
          " 1 ",
          "abc",
      ]
  
      for port_str in port_strs:
          with self.subTest(port_str=port_str):
              port = _try_parse_port(port_str)
  
              self.assertIsNone(port)
  
imports: import threading
  import time
  import socket
  from datetime import timedelta
  from typing import List
  from unittest import TestCase
  from unittest.mock import patch
  from torch.distributed.elastic.rendezvous.utils import _PeriodicTimer, _delay, _matches_machine_hostname, _parse_rendezvous_config, _try_parse_port, parse_rendezvous_endpoint
label_desc: Use image node_id 6 for calling the UtilsTest obj's underlying member method code with example usage: obj.test_try_parse_port_returns_none_if_str_is_invalid() without return types