test_r_tileset.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. """
  2. Created on Sun Jun 08 19:42:32 2018
  3. @author: Sanjeet Bhatti
  4. """
  5. from grass.gunittest.case import TestCase
  6. from grass.gunittest.main import test
  7. from grass.gunittest.gmodules import SimpleModule
  8. from grass.script.utils import decode
  9. import os
  10. output = """\
  11. -78.77462049|35.6875073|-78.60830318|35.74855834|1506|678
  12. -78.77462049|35.74855834|-78.60830318|35.80960938|1506|678
  13. """.replace(
  14. "\n", os.linesep
  15. )
  16. class TestRTileset(TestCase):
  17. """Test r.tileset script"""
  18. mapName = "elevation"
  19. @classmethod
  20. def setUpClass(cls):
  21. """Use temporary region settings"""
  22. cls.use_temp_region()
  23. cls.runModule("g.region", raster=cls.mapName, flags="p")
  24. @classmethod
  25. def tearDownClass(cls):
  26. """!Remove the temporary region"""
  27. cls.del_temp_region()
  28. def test_tiling(self):
  29. """Produce tiling test"""
  30. module = SimpleModule(
  31. "r.tileset", sourceproj="+init=epsg:4326", maxrows=1024, maxcols=2048
  32. )
  33. self.assertModule(module)
  34. self.assertMultiLineEqual(decode(module.outputs.stdout), output)
  35. if __name__ == "__main__":
  36. test()