class_docstr: A suite of unit tests for ship_logs.py
  
  Yeah, it's a hack that these tests live in e2e tests.  But since they test python code it's
  just easier this way.
class_docstr_tok: ["A","suite","of","unit","tests","for","ship_logs.py","Yeah",",","it","'s","a","hack","that","these","tests","live","in","e2e","tests",".","But","since","they","test","python","code","it's","just","easier","this","way","."]
code: def test_line_endings_are_kept(self) -> None:
      # If re.DOTALL is not used in the regex patterns, then pattern matching can unintentionally
      # strip the newlines out of the end of the line.
      cmd = mkcmd(
          r"""
              print("match neither\n", end="")
              print("[rank=0] match just rank\n", end="")
              print("[rank=0] INFO: match rank and level\n", end="")
              print("INFO: match just level\n", end="")
              """
      )
      with ShipLogServer() as srv:
          exit_code = self.run_ship_logs(srv.master_url(), cmd)
      assert exit_code == 0, exit_code
      expect_logs = [
          "match neither\n",
          "match just rank\n",
          "match rank and level\n",
          "match just level\n",
      ]
      assert srv.logs == expect_logs, srv.logs
  
imports: import io
  import json
  import logging
  import os
  import shutil
  import signal
  import socket
  import ssl
  import subprocess
  import sys
  import tempfile
  import textwrap
  import threading
  import time
  from typing import Any, List, Optional
  import pytest
label_desc: Use image node_id 4 for calling the TestShipLogs obj's underlying member method code with example usage: obj.test_line_endings_are_kept() without return types