test_r_info.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. """
  2. Name: r.info test
  3. Purpose: Tests r.info and its flags/options.
  4. Author: Sunveer Singh, Google Code-in 2017
  5. Copyright: (C) 2017 by Sunveer 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.gmodules import SimpleModule
  12. class TestReport(TestCase):
  13. @classmethod
  14. def setUpClass(cls):
  15. """Use temporary region settings"""
  16. cls.use_temp_region()
  17. @classmethod
  18. def tearDownClass(cls):
  19. """!Remove the temporary region"""
  20. cls.del_temp_region()
  21. def test_flagg(self):
  22. """Testing flag g with map geology_30m using simple module"""
  23. output_str="""north=228500
  24. south=215000
  25. east=645000
  26. west=630000
  27. nsres=10
  28. ewres=10
  29. rows=1350
  30. cols=1500
  31. cells=2025000
  32. datatype=CELL
  33. ncats=43600"""
  34. self.assertModuleKeyValue(module='r.info', map='lakes', flags='g', reference=output_str,
  35. precision=2, sep="=")
  36. def test_flagr(self):
  37. """Testing flag r with map landcover_1m using simple module"""
  38. output_str="""min=34300
  39. max=43600"""
  40. self.assertModuleKeyValue(module='r.info', map='lakes', flags='r', reference=output_str,
  41. precision=2, sep="=")
  42. def test_flage(self):
  43. """Testing flag e with map lsat7_2002_50"""
  44. self.assertModule('r.info', map='lakes', flags='e')
  45. def test_flagh(self):
  46. """Testing flag h with map zipcodes"""
  47. self.assertModule('r.info', map='lakes', flags='h')
  48. if __name__ == '__main__':
  49. from grass.gunittest.main import test
  50. test()