test_r_tileset.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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('\n', os.linesep)
  14. class TestRTileset(TestCase):
  15. """Test r.tileset script"""
  16. mapName = 'elevation'
  17. @classmethod
  18. def setUpClass(cls):
  19. """Use temporary region settings"""
  20. cls.use_temp_region()
  21. cls.runModule('g.region', raster=cls.mapName, flags='p')
  22. @classmethod
  23. def tearDownClass(cls):
  24. """!Remove the temporary region"""
  25. cls.del_temp_region()
  26. def test_tiling(self):
  27. """Produce tiling test"""
  28. module = SimpleModule('r.tileset', sourceproj='+init=epsg:4326',
  29. maxrows=1024, maxcols=2048)
  30. self.assertModule(module)
  31. self.assertMultiLineEqual(decode(module.outputs.stdout), output)
  32. if __name__ == '__main__':
  33. test()