test_r_shade.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. """
  2. Created on Sun Jun 08 13:44:07 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. class TestRShade(TestCase):
  9. """Test r.shade script"""
  10. mapName = 'aspect'
  11. color = 'elevation'
  12. outputMap = 'elevation_aspect_shaded'
  13. @classmethod
  14. def setUpClass(cls):
  15. """Create maps in a small region."""
  16. cls.use_temp_region()
  17. cls.runModule('g.region', raster=cls.mapName, flags='p')
  18. @classmethod
  19. def tearDownClass(cls):
  20. """Remove temporary region"""
  21. cls.runModule('g.remove', flags='f', type='raster',
  22. name=cls.outputMap)
  23. cls.del_temp_region()
  24. def test_shade_map(self):
  25. """Generates a color raster map over shaded relief map test"""
  26. module = SimpleModule('r.shade', shade=self.mapName, color=self.color,
  27. output=self.outputMap)
  28. self.assertModule(module)
  29. self.assertRasterExists(self.outputMap)
  30. if __name__ == '__main__':
  31. test()