code: def test_calc_res():
      x = [5, 7]
      y = [0, 1]
      z = [[0, 0], [0, 0]]
      dims = ("y", "x")
  
      # x and y increasing
      xarr = DataArray(z, coords=dict(x=x, y=y), dims=dims)
      xres, yres = calc_res(xarr)
      assert xres == 2
      assert yres == -1
  
      # x increasing, y decreasing
      xarr = DataArray(z, coords=dict(x=x, y=y[::-1]), dims=dims)
      xres, yres = calc_res(xarr)
      assert xres == 2
      assert yres == 1
  
      # x decreasing, y increasing
      xarr = DataArray(z, coords=dict(x=x[::-1], y=y), dims=dims)
      xres, yres = calc_res(xarr)
      assert xres == -2
      assert yres == -1
  
      # x and y decreasing
      xarr = DataArray(z, coords=dict(x=x[::-1], y=y[::-1]), dims=dims)
      xres, yres = calc_res(xarr)
      assert xres == -2
      assert yres == 1
  
file_path: datashader/datashader/tests/test_utils.py
imports: from __future__ import annotations
  import numpy
  from xarray import DataArray
  from datashader.datashape import dshape
  from datashader.utils import Dispatcher, apply, calc_res, isreal, orient_array
label_desc: Use image node_id 4 for calling a global function with example usage: test_calc_res() without return types