class_docstr: Test the FciL2NCSegmentFileHandler reader.
class_docstr_tok: ["Test","the","FciL2NCSegmentFileHandler","reader","."]
docstr: Set up the test by creating a test file and opening it with the reader.
docstr_tok: ["Set","up","the","test","by","creating","a","test","file","and","opening","it","with","the","reader","."]
code: def setUp(self):
      """Set up the test by creating a test file and opening it with the reader."""
      # Easiest way to test the reader is to create a test netCDF file on the fly
      self.seg_test_file = str(uuid.uuid4()) + ".nc"
      with Dataset(self.seg_test_file, "w") as nc:
          # Create dimensions
          nc.createDimension("number_of_FoR_cols", 348)
          nc.createDimension("number_of_FoR_rows", 348)
          nc.createDimension("number_of_channels", 8)
          nc.createDimension("number_of_categories", 6)
  
          # add global attributes
          nc.data_source = "test_fci_data_source"
          nc.platform = "test_fci_platform"
  
          # Add datasets
          x = nc.createVariable(
              "x", np.float32, dimensions=("number_of_FoR_cols",)
          )
          x.standard_name = "projection_x_coordinate"
          x[:] = np.arange(348)
  
          y = nc.createVariable(
              "y", np.float32, dimensions=("number_of_FoR_rows",)
          )
          y.standard_name = "projection_y_coordinate"
          y[:] = np.arange(348)
  
          s = nc.createVariable("product_quality", np.int8)
          s[:] = 99.0
  
          chans = nc.createVariable(
              "channels", np.float32, dimensions=("number_of_channels",)
          )
          chans.standard_name = "fci_channels"
          chans[:] = np.arange(8)
  
          cats = nc.createVariable(
              "categories",
              np.float32,
              dimensions=("number_of_categories",),
          )
          cats.standard_name = "product_categories"
          cats[:] = np.arange(6)
  
          test_dataset = nc.createVariable(
              "test_values",
              np.float32,
              dimensions=(
                  "number_of_FoR_rows",
                  "number_of_FoR_cols",
                  "number_of_channels",
                  "number_of_categories",
              ),
          )
  
          test_dataset[:] = self._get_unique_array(range(8), range(6))
          test_dataset.test_attr = "attr"
          test_dataset.units = "test_units"
  
imports: import os
  import unittest
  import uuid
  from contextlib import suppress
  from unittest import mock
  import numpy
  import pytest
  from netCDF4 import Dataset
  from pyresample import geometry
  from satpy.readers.fci_l2_nc import FciL2NCAMVFileHandler, FciL2NCFileHandler, FciL2NCSegmentFileHandler
  from satpy.tests.utils import make_dataid
label_desc: Use image node_id 1 for calling the TestFciL2NCSegmentFileHandler obj's underlying member method code with example usage: obj.setUp() without return types