testrmode.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. """
  2. Name: r.mode test
  3. Purpose: Tests r.mode and its flags/options.
  4. Author: Supreet Singh
  5. Copyright: (C) 2018 by Supreet Singh and the GRASS Development Team
  6. Licence: This program is free software under the GNU General Public
  7. License (>=v2). Read the file COPYING that comes with GRASS
  8. for details.
  9. """
  10. from grass.gunittest.case import TestCase
  11. from grass.gunittest.main import test
  12. class Testrmode(TestCase):
  13. output = 'rmode'
  14. base = 'geology'
  15. cover = 'soils'
  16. @classmethod
  17. def setUpClass(cls):
  18. cls.use_temp_region()
  19. cls.runModule('g.region', raster=cls.base, flags='d')
  20. @classmethod
  21. def tearDownClass(cls):
  22. cls.del_temp_region()
  23. def tearDown(self):
  24. self.runModule('g.remove', type='raster', flags='f', name=self.output)
  25. def test_1(self):
  26. self.assertModule('r.mode', base=self.base, cover=self.cover, output=self.output)
  27. self.assertRasterMinMax(map=self.output, refmin=21513, refmax=46487,
  28. msg="soils must be between 21513 and 46487")
  29. if __name__ == '__main__':
  30. test()