class_docstr: Test case for CF writer.
docstr: Check global attributes are set.
docstr_tok: ["Check","global","attributes","are","set","."]
code: def test_header_attrs(self):
      """Check global attributes are set."""
      scn = Scene()
      start_time = datetime(2018, 5, 30, 10, 0)
      end_time = datetime(2018, 5, 30, 10, 15)
      scn["test-array"] = xr.DataArray(
          [1, 2, 3],
          attrs=dict(start_time=start_time, end_time=end_time),
      )
      with TempFile() as filename:
          header_attrs = {
              "sensor": "SEVIRI",
              "orbit": 99999,
              "none": None,
              "list": [1, 2, 3],
              "set": {1, 2, 3},
              "dict": {"a": 1, "b": 2},
              "nested": {"outer": {"inner1": 1, "inner2": 2}},
              "bool": True,
              "bool_": np.bool_(True),
          }
          scn.save_datasets(
              filename=filename,
              header_attrs=header_attrs,
              flatten_attrs=True,
              writer="cf",
          )
          with xr.open_dataset(filename) as f:
              assert "history" in f.attrs
              assert f.attrs["sensor"] == "SEVIRI"
              assert f.attrs["orbit"] == 99999
              np.testing.assert_array_equal(f.attrs["list"], [1, 2, 3])
              assert f.attrs["set"] == "{1, 2, 3}"
              assert f.attrs["dict_a"] == 1
              assert f.attrs["dict_b"] == 2
              assert f.attrs["nested_outer_inner1"] == 1
              assert f.attrs["nested_outer_inner2"] == 2
              assert f.attrs["bool"] == "true"
              assert f.attrs["bool_"] == "true"
              assert "none" not in f.attrs.keys()
  
imports: import os
  import tempfile
  import warnings
  from datetime import datetime
  import numpy
  import pytest
  import xarray
  from packaging.version import Version
  from satpy import Scene
  from satpy.tests.utils import make_dsq
  from satpy.writers.cf_writer import _get_backend_versions
label_desc: Use image node_id 16 for calling the TestCFWriter obj's underlying member method code with example usage: obj.test_header_attrs() without return types