Skip to content

Commit 7efdbb9

Browse files
committed
Add loop test
1 parent 0ec365d commit 7efdbb9

1 file changed

Lines changed: 22 additions & 10 deletions

File tree

tests/test_convertbng.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
import unittest
2-
import numpy as np
31
import array
42
import math
3+
import unittest
4+
from ctypes import ArgumentError
5+
from random import randint, randrange
6+
7+
import numpy as np
8+
from convertbng.cutil import convert_bng as cconvert_bng
9+
510
from convertbng.util import (
611
convert_bng,
12+
convert_epsg3857_to_wgs84,
13+
convert_etrs89_to_lonlat,
14+
convert_etrs89_to_osgb36,
715
convert_lonlat,
8-
convert_to_osgb36,
9-
convert_osgb36_to_lonlat,
1016
convert_osgb36_to_etrs89,
11-
convert_etrs89_to_osgb36,
12-
convert_etrs89_to_lonlat,
13-
convert_epsg3857_to_wgs84,
17+
convert_osgb36_to_lonlat,
1418
convert_to_etrs89,
19+
convert_to_osgb36,
1520
)
16-
from convertbng.cutil import convert_bng as cconvert_bng
17-
from ctypes import ArgumentError
18-
from random import randrange
1921

2022

2123
class ConvertbngTests(unittest.TestCase):
@@ -58,6 +60,16 @@ def testCythonConvertList(self):
5860
)
5961
self.assertEqual(expected[0][0], result[0][0])
6062

63+
def test_loop(self):
64+
"""See https://github.com/urschrei/convertbng/issues/101"""
65+
66+
def test_conversion(easting, northing):
67+
res = convert_lonlat(easting, northing)
68+
return [res[0][0], res[1][0]]
69+
70+
for i in range(500000):
71+
test_conversion([randint(10000, 50000)], [randint(10000, 50000)])
72+
6173
def testConvertBNG(self):
6274
"""Test multithreaded BNG --> lon, lat function"""
6375
expected = ([-0.32822654, -2.01831267], [51.44533145, 54.58910534])

0 commit comments

Comments
 (0)