Changeset 53abe8b in osmosebackend
 Timestamp:
 Jun 18, 2014 9:06:35 PM (5 years ago)
 Branches:
 master
 Children:
 5236d9b, 798beda
 Parents:
 a15a05a
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

modules/OsmoseErrorFile.py
r3bcb0de r53abe8b 154 154 self.outxml.endElement('fixes') 155 155 156 ################################################################################ 157 import unittest 156 158 157 if __name__ == "__main__": 158 import pprint 159 a = ErrorFile(None) 160 def check(b, c): 161 d = a.fixdiff(b) 159 class Test(unittest.TestCase): 160 def setUp(self): 161 162 class config: 163 polygon_id = None 164 self.a = ErrorFile(config) 165 166 def check(self, b, c): 167 import pprint 168 d = self.a.fixdiff(b) 162 169 pp = pprint.PrettyPrinter(indent=4) 163 170 pp.pprint(d) 164 if d != c: 165 raise Exception("fixdiff Excepted %s to %s but get %s" % (b, c, d) ) 166 check([[None]], [[None]] ) 167 check({"t": "v"}, [[{"~": {"t": "v"}}]] ) 168 check({"~": {"t": "v"}}, [[{"~": {"t": "v"}}]] ) 169 check({"~": {"t": "v"}, "+": {"t": "v"}}, [[{"~": {"t": "v"}, "+": {"t": "v"}}]] ) 170 check([{"~": {"t": "v"}, "+": {"t": "v"}}], [[{"~": {"t": "v"}, "+": {"t": "v"}}]] ) 171 check([{"~": {"t": "v"}}, {"+": {"t": "v"}}], [[{"~": {"t": "v"}}], [{"+": {"t": "v"}}]] ) 172 check([[{"t": "v"}], [{"t": "v"}]], [[{"~": {"t": "v"}}], [{"~": {"t": "v"}}]] ) 173 check([[None, {"t": "v"}]], [[None, {"~": {"t": "v"}}]] ) 171 self.assertEquals(c, d, "fixdiff Excepted %s to %s but get %s" % (b, c, d)) 172 173 def test(self): 174 self.check([[None]], [[None]] ) 175 self.check({"t": "v"}, [[{"~": {"t": "v"}}]] ) 176 self.check({"~": {"t": "v"}}, [[{"~": {"t": "v"}}]] ) 177 self.check({"~": {"t": "v"}, "+": {"t": "v"}}, [[{"~": {"t": "v"}, "+": {"t": "v"}}]] ) 178 self.check([{"~": {"t": "v"}, "+": {"t": "v"}}], [[{"~": {"t": "v"}, "+": {"t": "v"}}]] ) 179 self.check([{"~": {"t": "v"}}, {"+": {"t": "v"}}], [[{"~": {"t": "v"}}], [{"+": {"t": "v"}}]] ) 180 self.check([[{"t": "v"}], [{"t": "v"}]], [[{"~": {"t": "v"}}], [{"~": {"t": "v"}}]] ) 181 self.check([[None, {"t": "v"}]], [[None, {"~": {"t": "v"}}]] )
Note: See TracChangeset
for help on using the changeset viewer.