class_docstr: A pytest class suite for gpustat.
class_docstr_tok: ["A","pytest","class","suite","for","gpustat","."]
docstr: A basic functionality test, in a case where everything is normal.
code: def test_new_query_mocked_basic(
      self, scenario_basic, nvidia_driver_version
  ):
      """A basic functionality test, in a case where everything is normal."""
  
      gpustats = gpustat.new_query()
      fp = StringIO()
      gpustats.print_formatted(
          fp=fp,
          no_color=False,
          show_user=True,
          show_cmd=True,
          show_full_cmd=True,
          show_pid=True,
          show_fan_speed=True,
          show_codec="enc,dec",
          show_power=True,
      )
  
      result = fp.getvalue()
      print(result)
  
      unescaped = remove_ansi_codes(result)
      # remove first line (header)
      unescaped = os.linesep.join(unescaped.splitlines()[1:])
  
      assert unescaped == MOCK_EXPECTED_OUTPUT_FULL_PROCESS
  
      # verify gpustat results (not exhaustive yet)
      assert gpustats.driver_version == nvidia_driver_version.name
      g: gpustat.GPUStat = gpustats.gpus[0]
      assert g.memory_used == 8000
      assert g.power_draw == 125
      assert g.utilization == 76
      assert g.processes and g.processes[0]["pid"] == 48448
  
imports: import ctypes
  import os
  import re
  import shlex
  import sys
  import types
  from collections import namedtuple
  from io import StringIO
  from typing import Any
  import psutil
  import pytest
  from mockito import ANY, mock, unstub, when, when2
  import gpustat
  from gpustat.nvml import pynvml, pynvml_monkeypatch
label_desc: Use image node_id 4 for calling the TestGPUStat obj's underlying member method code with example usage: obj.test_new_query_mocked_basic(scenario_basic, nvidia_driver_version) without return types