test_r_plane.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. """
  2. Created on Sun Jun 08 12:12:34 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 TestRPlane(TestCase):
  9. """Test r.plane script"""
  10. mapName = 'elevation'
  11. mapOutput = 'myplane45'
  12. @classmethod
  13. def setUpClass(cls):
  14. """Create maps in a small region."""
  15. cls.use_temp_region()
  16. cls.runModule('g.region', raster=cls.mapName, flags='p')
  17. @classmethod
  18. def tearDownClass(cls):
  19. """Remove temporary region"""
  20. cls.runModule('g.remove', flags='f', type='raster',
  21. name=cls.mapOutput)
  22. cls.del_temp_region()
  23. def test_creates_raster_plane_map(self):
  24. """Create a tilted plane raster map test"""
  25. module = SimpleModule('r.plane', output=self.mapOutput, dip=45,
  26. easting=527500.0, northing=165000.0,
  27. elevation=1000, type='FCELL')
  28. self.assertModule(module)
  29. self.assertRasterExists(self.mapOutput)
  30. if __name__ == '__main__':
  31. test()