class_docstr: Test NetCDF4 File Handler Utility class.
class_docstr_tok: ["Test","NetCDF4","File","Handler","Utility","class","."]
docstr: Test everything about the NetCDF4 class.
docstr_tok: ["Test","everything","about","the","NetCDF4","class","."]
code: def test_all_basic(self):
      """Test everything about the NetCDF4 class."""
      import xarray as xr
  
      from satpy.readers.netcdf_utils import NetCDF4FileHandler
  
      file_handler = NetCDF4FileHandler("test.nc", {}, {})
  
      assert file_handler["/dimension/rows"] == 10
      assert file_handler["/dimension/cols"] == 100
  
      for ds in (
          "test_group/ds1_f",
          "test_group/ds1_i",
          "ds2_f",
          "ds2_i",
      ):
          assert file_handler[ds].dtype == (
              np.float32 if ds.endswith("f") else np.int32
          )
          assert file_handler[ds + "/shape"] == (10, 100)
          assert file_handler[ds + "/dimensions"] == ("rows", "cols")
          assert (
              file_handler[ds + "/attr/test_attr_str"] == "test_string"
          )
          assert file_handler[ds + "/attr/test_attr_int"] == 0
          assert file_handler[ds + "/attr/test_attr_float"] == 1.2
  
      test_group = file_handler["test_group"]
      assert test_group["ds1_i"].shape == (10, 100)
      assert test_group["ds1_i"].dims == ("rows", "cols")
  
      assert file_handler["/attr/test_attr_str"] == "test_string"
      assert file_handler["/attr/test_attr_str_arr"] == "test_string2"
      assert file_handler["/attr/test_attr_int"] == 0
      assert file_handler["/attr/test_attr_float"] == 1.2
  
      global_attrs = {
          "test_attr_str": "test_string",
          "test_attr_str_arr": "test_string2",
          "test_attr_int": 0,
          "test_attr_float": 1.2,
      }
      assert file_handler["/attrs"] == global_attrs
  
      assert isinstance(file_handler.get("ds2_f")[:], xr.DataArray)
      assert file_handler.get("fake_ds") is None
      assert file_handler.get("fake_ds", "test") == "test"
  
      assert ("ds2_f" in file_handler) is True
      assert ("fake_ds" in file_handler) is False
      assert file_handler.file_handle is None
      assert file_handler["ds2_sc"] == 42
  
imports: import os
  import unittest
  import numpy
  import pytest
label_desc: Use image node_id 3 for calling the TestNetCDF4FileHandler obj's underlying member method code with example usage: obj.test_all_basic() without return types