jschuengel: thuban/Extensions/umn_mapserver/test test_mapserver.py, 1.4, 1.5
cvs@intevation.de
cvs at intevation.de
Thu Jul 22 14:39:29 CEST 2004
Author: jschuengel
Update of /thubanrepository/thuban/Extensions/umn_mapserver/test
In directory doto:/tmp/cvs-serv29828/test
Modified Files:
test_mapserver.py
Log Message:
Added a test for the range expression import.
Index: test_mapserver.py
===================================================================
RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/test/test_mapserver.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- test_mapserver.py 14 Jul 2004 10:32:29 -0000 1.4
+++ test_mapserver.py 22 Jul 2004 12:39:27 -0000 1.5
@@ -34,6 +34,8 @@
from Extensions.umn_mapserver.mapfile import shp_type
+from Extensions.umn_mapserver.mf_import import create_rangeexpression
+
class mapserver_generalClasses(unittest.TestCase):
def setUp(self):
@@ -306,6 +308,88 @@
self.eq(testweb.get_imageurl(),"/tmpurl/")
testweb.set_imageurl("/tmpurlset/")
self.eq(testweb.get_imageurl(), "/tmpurlset/")
+
+
+class mapserver_mf_import(unittest.TestCase):
+
+ def setUp(self):
+ """
+ Running this funktion befor each test
+ """
+ # using the sample map
+ testMapfile = 'test.map'
+ self.testMap = mapObj(testMapfile)
+ self.eq = self.assertEquals
+
+
+ def test_create_rangeexpression(self):
+ """
+ testing the range expression creation from the code in the mapfile
+ """
+ # the expressions to test
+ # these expresions are like in thuban
+ test1 = "([ATTR] >= 1 AND [ATTR] <= 100)" # [min,max]
+ code,expr = create_rangeexpression(test1[1:-1])
+ self.eq(code, "ATTR")
+ self.eq(expr,"[1;100]")
+ test2 = "([ATTR] >= 1 AND [ATTR] < 100)" # [min,max[
+ code,expr = create_rangeexpression(test2[1:-1])
+ self.eq(code, "ATTR")
+ self.eq(expr,"[1;100[")
+ test3 = "([ATTR] > 1 AND [ATTR] <= 100)" # ]min,max]
+ code,expr = create_rangeexpression(test3[1:-1])
+ self.eq(code, "ATTR")
+ self.eq(expr,"]1;100]")
+ test4 = "([ATTR] > 1 AND [ATTR] < 100)" # ]min,max[
+ code,expr = create_rangeexpression(test4[1:-1])
+ self.eq(code, "ATTR")
+ self.eq(expr,"]1;100[")
+
+ test5 = "([ATTR] <= 100)" # [-oo,max] , ]-oo,max]
+ code,expr = create_rangeexpression(test5[1:-1])
+ self.eq(code, "ATTR")
+ self.eq(expr,"[-oo;100]")
+ test6 = "([ATTR] < 100)" # [-oo,max[ , ]-oo,max[
+ code,expr = create_rangeexpression(test6[1:-1])
+ self.eq(code, "ATTR")
+ self.eq(expr,"[-oo;100[")
+ test7 = "([ATTR] >= 1)" # [min,oo] , [min, oo[
+ code,expr = create_rangeexpression(test7[1:-1])
+ self.eq(code, "ATTR")
+ self.eq(expr,"[1;oo]")
+ test8 = "([ATTR] > 1)" # ]min,oo] , ]min, oo[
+ code,expr = create_rangeexpression(test8[1:-1])
+ self.eq(code, "ATTR")
+ self.eq(expr,"]1;oo]")
+
+ # value equal, works but is not really usefull
+ test9= "([ATTR] < 1 AND [ATTR] >= 1)"
+ code,expr = create_rangeexpression(test9[1:-1])
+ self.eq(code, "ATTR")
+ self.eq(expr,"[1;1[")
+
+ # works but must be changed the order
+ test10= "([ATTR] <= 100 AND [ATTR] >= 1)"
+ code,expr = create_rangeexpression(test10[1:-1])
+ self.eq(code, "ATTR")
+ self.eq(expr,"[1;100]")
+
+ #singleton not implemented yet
+ test11 = "([ATTR] = 1)"
+ code,expr = create_rangeexpression(test11[1:-1])
+ self.eq(code, None)
+ self.eq(expr,"singleton creation not implemented yet")
+
+ # Attributes not equal
+ test12= "([ATTR] < 100 AND [ATTR2] >= 1)"
+ code,expr = create_rangeexpression(test12[1:-1])
+ self.eq(code, None)
+ self.eq(expr,"Attributes not equal")
+ # dont works, is not supported by thuban
+ test13="([ATTR] > 100 AND [ATTR] < 1)"
+ code,expr = create_rangeexpression(test13[1:-1])
+ self.eq(code, None)
+ self.eq(expr,"values are wrong")
if __name__ == '__main__':
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)