code: def test_merge_precision(tmpdir, precision):
      """See https://github.com/rasterio/rasterio/issues/1837"""
      # TDOD move ascii grids to a fixture?
  
      expected = """\
          ncols        8
          nrows        8
          xllcorner    0.000000000000
          yllcorner    0.000000000000
          cellsize     1.000000000000
          1 2 3 4 1 2 3 4
          3 4 5 6 3 4 5 6
          4 5 6 8 4 5 6 8
          7 9 5 4 7 9 5 4
          1 2 3 4 1 2 3 4
          3 4 5 6 3 4 5 6
          4 5 6 8 4 5 6 8
          7 9 5 4 7 9 5 4
          """
  
      expected_file = StringIO(textwrap.dedent(expected))
  
      template = """\
          ncols 4
          nrows 4
          xllcorner {:f}
          yllcorner {:f}
          cellsize 1.0
          1 2 3 4
          3 4 5 6
          4 5 6 8
          7 9 5 4
          """
  
      names = ["sw.asc", "se.asc", "nw.asc", "ne.asc"]
      corners = [(0.0, 0.0), (4.0, 0.0), (0.0, 4.0), (4.0, 4.0)]
  
      for name, (minx, miny) in zip(names, corners):
          content = textwrap.dedent(template.format(minx, miny))
          tmpdir.join(name).write(content)
  
      inputs = [str(tmpdir.join(name)) for name in names]
      outputname = str(tmpdir.join("merged.asc"))
  
      runner = CliRunner()
      result = runner.invoke(
          main_group,
          ["merge", "-f", "AAIGrid"]
          + precision
          + inputs
          + [outputname],
      )
      assert result.exit_code == 0
  
      # The arrangement of whitespace in the data part of the file
      # changed between 3.7 and 3.8 to better conform. We will compare
      # in a way that is more independent.
      with open(outputname) as out_file:
          # Compare header lines.
          for i in range(5):
              assert (
                  out_file.readline().strip()
                  == expected_file.readline().strip()
              )
  
          # Compare raster data as single strings.
          out_data = " ".join(
              line.strip() for line in out_file.readlines()
          )
          expected_data = " ".join(
              line.strip() for line in expected_file.readlines()
          )
          assert out_data == expected_data
  
imports: from io import StringIO
  import os
  import sys
  import textwrap
  from pathlib import Path
  import affine
  from click.testing import CliRunner
  import numpy
  from pytest import fixture
  import pytest
  import rasterio
  from rasterio.enums import Resampling
  from rasterio.merge import merge, MERGE_METHODS
  from rasterio.rio.main import main_group
  from rasterio.transform import Affine
label_desc: Use image node_id 28 for calling a global function with example usage: test_merge_precision(tmpdir, precision) without return types