[GRASS-SVN] r74295 - grass/trunk/vector/v.univar/testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 20 13:29:20 PDT 2019


Author: sbl
Date: 2019-03-20 13:29:20 -0700 (Wed, 20 Mar 2019)
New Revision: 74295

Modified:
   grass/trunk/vector/v.univar/testsuite/v_univar_test.py
Log:
fix v.univar test

Modified: grass/trunk/vector/v.univar/testsuite/v_univar_test.py
===================================================================
--- grass/trunk/vector/v.univar/testsuite/v_univar_test.py	2019-03-19 20:23:28 UTC (rev 74294)
+++ grass/trunk/vector/v.univar/testsuite/v_univar_test.py	2019-03-20 20:29:20 UTC (rev 74295)
@@ -15,47 +15,93 @@
 class TestProfiling(TestCase):
 
     def test_flagg(self):
-        """Testing flag g with map bridges"""
-        output_str="""n=2537
-        nmissing=0
-        nnull=0
-        min=1
-        max=2537
-        range=2536
-        sum=3.21945e+06
-        mean=1269
-        mean_abs=1269
-        population_stddev=732.369
-        population_variance=536364
-        population_coeff_variation=0.577123
-        sample_stddev=732.513
-        sample_variance=536576
-        kurtosis=-1.20142
-        skewness=0"""
+        """Testing flag g with map census"""
+        output_str = """n=2537
+nmissing=0
+nnull=0
+min=1
+max=2537
+range=2536
+sum=3.21945e+06
+mean=1269
+mean_abs=1269
+population_stddev=732.369
+population_variance=536364
+population_coeff_variation=0.577123
+sample_stddev=732.513
+sample_variance=536576
+kurtosis=-1.20142
+skewness=0"""
         v_univar = SimpleModule("v.univar", flags="g", map='census', column='cat')
-        self.assertModuleKeyValue(module='v.univar', map='census', column='cat', flags='g', reference=output_str,
-	                                  precision=2, sep="=")
+        v_univar.run()
+        self.assertLooksLike(actual=v_univar.outputs.stdout.encode('utf8'),
+                             reference=output_str)
 
     def test_flage(self):
         """Testing flag e with map geology"""
-        self.assertModule('v.univar', map='geology', column='PERIMETER', flags='e')
+        output_str = """number of features with non NULL attribute: 1832
+number of missing attributes: 0
+number of NULL attributes: 0
+minimum: 166.947
+maximum: 2.72948e+06
+range: 2.72932e+06
+sum: 7.88761e+07
+mean: 43054.7
+mean of absolute values: 43054.7
+population standard deviation: 132689
+population variance: 1.76064e+10
+population coefficient of variation: 3.08187
+sample standard deviation: 132725
+sample variance: 1.7616e+10
+kurtosis: 139.157
+skewness: 9.7065
+1st quartile: 3699.32
+median (even number of cells): 10308.4
+3rd quartile: 29259.1
+90th percentile: 86449.7"""
+        v_univar = SimpleModule('v.univar', map='geology', column='PERIMETER', flags='e')
+        v_univar.run()
+        self.assertLooksLike(actual=v_univar.outputs.stdout.encode('utf8'),
+                             reference=output_str)
  
     def test_flagw(self):
         """Testing flag w with map lakes"""
-        self.assertModule('v.univar', map='hospitals', column='cat', flags='w')
+        output_str = """number of features with non NULL attribute: 15279
+number of missing attributes: 0
+number of NULL attributes: 0
+minimum: 2
+maximum: 15280
+range: 15278
+sum: 5.76349e+11
+mean: 6190.76
+mean of absolute values: 6190.76"""
+        v_univar = SimpleModule('v.univar', map='lakes', column='FULL_HYDRO', flags='w')
+        v_univar.run()
+        self.assertLooksLike(actual=v_univar.outputs.stdout.encode('utf8'),
+                             reference=output_str)
 
     def test_flagd(self):
         """Testing flag d with map hospitals"""
-        univar_string="""n=160
-        nmissing=0
-        nnull=0
-        min=1
-        max=160
-        range=159
-        sum=12880
-        mean=80.5
-        mean_abs=80.5"""
-        self.assertModule('v.univar', map='hospitals', column='CITY', flags='d')
+        univar_string = """number of primitives: 160
+number of non zero distances: 12561
+number of zero distances: 0
+minimum: 9.16773
+maximum: 760776
+range: 760767
+sum: 2.69047e+09
+mean: 214193
+mean of absolute values: 214193
+population standard deviation: 128505
+population variance: 1.65136e+10
+population coefficient of variation: 0.599953
+sample standard deviation: 128511
+sample variance: 1.6515e+10
+kurtosis: 0.277564
+skewness: 0.801646"""
+        v_univar = SimpleModule('v.univar', map='hospitals', column='CITY', flags='d')
+        v_univar.run()
+        self.assertLooksLike(actual=v_univar.outputs.stdout.encode('utf8'),
+                             reference=univar_string)
 		
     def test_output(self):
         """Testing output of v.univar"""



More information about the grass-commit mailing list