From 436894fe7fb93bafeb6df7c373045678ef84a718 Mon Sep 17 00:00:00 2001 From: dekanluc Date: Sat, 30 May 2020 10:48:01 +0200 Subject: [PATCH] first try of r.stats #10 testing r.stats #10 Co-Authored-By: josefpudil --- raster/r.stats/test_suite/test_r_stats.py | 35 +++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 raster/r.stats/test_suite/test_r_stats.py diff --git a/raster/r.stats/test_suite/test_r_stats.py b/raster/r.stats/test_suite/test_r_stats.py new file mode 100644 index 000000000..71de3cbfd --- /dev/null +++ b/raster/r.stats/test_suite/test_r_stats.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +from grass.gunittest.case import TestCase +from grass.gunittest.main import test +import grass.script as gscript + +output = 'test1' +stats = 'lakes' +data = [['34300=44200.000000'], + ['39000=3509900.000000'], + ['43600=47000.000000']] + + +class Test_r_stats(TestCase): + @classmethod + def setUpClass(cls): + cls.use_temp_region() + cls.runModule('g.region', raster = stats) + + + @classmethod + def tearDownClass(cls): + cls.del_temp_region() + +# testing total area + def test_check_area(self): + #self.assertModule('r.stats', input = stats , flags = 'aN') + module = self.assertModule('r.stats', input = stats , flags = 'aN',separator = '=') + print(self.assertModule('r.stats', input = stats , flags = 'aN',separator = '=')) + #self.assertModuleKeyValue(module, + # reference=dict('34300'='44200' , '39000'='3509900' , '43600'='47000'), + # precision=1, sep='=') + self.assertEqual(data,module) +if __name__ == '__main__': + test() \ No newline at end of file