class_docstr: wrap_udf_in_torch_dist_launcher()
class_docstr_tok: ["wrap_udf_in_torch_dist_launcher","(",")"]
code: def test_py_versions(self):
      # test that this correctly handles different py versions/binaries
      py_binaries = (
          "python3.7",
          "python3.8",
          "python3.9",
          "python3",
          "python",
      )
      udf_command = "{python_bin} path/to/some/trainer.py arg1 arg2"
  
      for py_bin in py_binaries:
          wrapped_udf_command = wrap_udf_in_torch_dist_launcher(
              udf_command=udf_command.format(python_bin=py_bin),
              num_trainers=2,
              num_nodes=2,
              node_rank=1,
              master_addr="127.0.0.1",
              master_port=1234,
          )
          expected = (
              "{python_bin} -m torch.distributed.run ".format(
                  python_bin=py_bin
              )
              + "--nproc_per_node=2 --nnodes=2 --node_rank=1 --master_addr=127.0.0.1 "
              "--master_port=1234 path/to/some/trainer.py arg1 arg2"
          )
          self.assertEqual(wrapped_udf_command, expected)
  
file_path: dgl/tests/tools/test_launch.py
imports: import json
  import os
  import tempfile
  import unittest
  from launch import *
label_desc: Use image node_id 3 for calling the TestWrapUdfInTorchDistLauncher obj's underlying member method code with example usage: obj.test_py_versions() without return types