test_r_out_xyz.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. """
  2. Created on Sun Jun 08 10:11:18 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. import os
  9. class TestROutXyz(TestCase):
  10. """Test r.out.xyz script"""
  11. mapName = "elev_lid792_1m"
  12. csvFile = "elev_lid792_1m.csv"
  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.del_temp_region()
  22. if os.path.isfile(cls.csvFile):
  23. os.remove(cls.csvFile)
  24. def test_r_out_xyz(self):
  25. """ASCII text file test"""
  26. module = SimpleModule(
  27. "r.out.xyz", input=self.mapName, output=self.csvFile, separator=","
  28. )
  29. self.assertModule(module)
  30. self.assertFileExists(filename=self.csvFile)
  31. if __name__ == "__main__":
  32. test()