class_docstr: Test the higher level resampling functions.
class_docstr_tok: ["Test","the","higher","level","resampling","functions","."]
docstr: Check that the type of resampled datasets is preserved.
code: def test_type_preserve(self):
      """Check that the type of resampled datasets is preserved."""
      from pyresample.geometry import SwathDefinition
  
      from satpy.resample import resample_dataset
  
      source_area = SwathDefinition(
          xr.DataArray(
              da.arange(4, chunks=5).reshape((2, 2)), dims=["y", "x"]
          ),
          xr.DataArray(
              da.arange(4, chunks=5).reshape((2, 2)), dims=["y", "x"]
          ),
      )
      dest_area = SwathDefinition(
          xr.DataArray(
              da.arange(4, chunks=5).reshape((2, 2)) + 0.0001,
              dims=["y", "x"],
          ),
          xr.DataArray(
              da.arange(4, chunks=5).reshape((2, 2)) + 0.0001,
              dims=["y", "x"],
          ),
      )
      expected_gap = np.array([[1, 2], [3, 255]])
      data = xr.DataArray(
          da.from_array(expected_gap, chunks=5), dims=["y", "x"]
      )
      data.attrs["_FillValue"] = 255
      data.attrs["area"] = source_area
      res = resample_dataset(data, dest_area)
      assert res.dtype == data.dtype
      assert np.all(res.values == expected_gap)
  
      expected_filled = np.array([[1, 2], [3, 3]])
      res = resample_dataset(
          data, dest_area, radius_of_influence=1000000
      )
      assert res.dtype == data.dtype
      assert np.all(res.values == expected_filled)
  
imports: import os
  import shutil
  import tempfile
  import unittest
  from unittest import mock
  import dask.array
  import numpy
  import pytest
  import xarray
  from pyproj import CRS
  from satpy.resample import NativeResampler
label_desc: Use image node_id 1 for calling the TestHLResample obj's underlying member method code with example usage: obj.test_type_preserve() without return types