summaryrefslogtreecommitdiff
path: root/ishtar_common/tests.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-10-30 09:56:08 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-10-30 09:56:08 +0100
commitb05763543d0984826715820edf7c59a2a65763e8 (patch)
tree51efd0dc1608c8e5d0d3b64073b1e8adf9c2ae9f /ishtar_common/tests.py
parentbe22353b89b61521757acc2e81e84d77b48b3547 (diff)
downloadIshtar-b05763543d0984826715820edf7c59a2a65763e8.tar.bz2
Ishtar-b05763543d0984826715820edf7c59a2a65763e8.zip
Tests: fix database error with arbitrary data
Diffstat (limited to 'ishtar_common/tests.py')
-rw-r--r--ishtar_common/tests.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index 4aa290ed1..e107bd6fb 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -127,14 +127,18 @@ class CommandsTestCase(TestCase):
town_nb = q.count()
first, union_start, union_end = '', '', []
for idx, town in enumerate(q.all()):
- l = 'MULTIPOLYGON((({x1} 1,{x2} 1,{x2} 0,{x1} 0,{x1} 1)))'.format(
- x1=idx, x2=idx + 1)
+ x1 = float(idx) / 10
+ if not x1:
+ x1 = 0
+ x2 = float(idx) / 10 + 0.1
+ l = 'MULTIPOLYGON((({x1} 0.1,{x2} 0.1,{x2} 0,{x1} 0,' \
+ '{x1} 0.1)))'.format(x1=x1, x2=x2)
if union_start:
union_start += ", "
else:
- first = '{x1} 1'.format(x1=idx)
- union_start += '{x2} 1'.format(x1=idx, x2=idx + 1)
- union_end.append('{x2} 0'.format(x1=idx, x2=idx + 1))
+ first = '{x1} 0.1'.format(x1=x1)
+ union_start += '{x2} 0.1'.format(x1=x1, x2=x2)
+ union_end.append('{x2} 0'.format(x1=x1, x2=x2))
town.limit = l
town.save()
union = 'MULTIPOLYGON (((' + first + ", " + union_start + \