code: def testStopwatch(self, mock_time):
      mock_time.return_value = 0
      sw = stopwatch.StopWatch()
      with sw("one"):
          mock_time.return_value += 0.002
      with sw("one"):
          mock_time.return_value += 0.004
      with sw("two"):
          with sw("three"):
              mock_time.return_value += 0.006
  
      @sw.decorate
      def four():
          mock_time.return_value += 0.004
  
      four()
  
      @sw.decorate("five")
      def foo():
          mock_time.return_value += 0.005
  
      foo()
  
      out = str(sw)
  
      # The names should be in sorted order.
      names = [l.split(None)[0] for l in out.splitlines()[1:]]
      self.assertEqual(
          names, ["five", "four", "one", "two", "two.three"]
      )
  
      one_line = out.splitlines()[3].split(None)
      self.assertLess(one_line[5], one_line[6])  # min < max
      self.assertEqual(one_line[7], "2")  # num
      # Can't test the rest since they'll be flaky.
  
      # Allow a few small rounding errors for the round trip.
      round_trip = str(stopwatch.StopWatch.parse(out))
      self.assertLess(
          ham_dist(out, round_trip), 15, "%s != %s" % (out, round_trip)
      )
  
file_path: pysc2/pysc2/lib/stopwatch_test.py
imports: import os
  from absl.testing import absltest
  import mock
  from pysc2.lib import stopwatch
label_desc: Use image node_id 1 for calling the StopwatchTest obj's underlying member method code with example usage: obj.testStopwatch(mock_time) without return types