|
1 | | -import unittest |
2 | | -import numpy as np |
3 | 1 | import array |
4 | 2 | 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 | + |
5 | 10 | from convertbng.util import ( |
6 | 11 | convert_bng, |
| 12 | + convert_epsg3857_to_wgs84, |
| 13 | + convert_etrs89_to_lonlat, |
| 14 | + convert_etrs89_to_osgb36, |
7 | 15 | convert_lonlat, |
8 | | - convert_to_osgb36, |
9 | | - convert_osgb36_to_lonlat, |
10 | 16 | convert_osgb36_to_etrs89, |
11 | | - convert_etrs89_to_osgb36, |
12 | | - convert_etrs89_to_lonlat, |
13 | | - convert_epsg3857_to_wgs84, |
| 17 | + convert_osgb36_to_lonlat, |
14 | 18 | convert_to_etrs89, |
| 19 | + convert_to_osgb36, |
15 | 20 | ) |
16 | | -from convertbng.cutil import convert_bng as cconvert_bng |
17 | | -from ctypes import ArgumentError |
18 | | -from random import randrange |
19 | 21 |
|
20 | 22 |
|
21 | 23 | class ConvertbngTests(unittest.TestCase): |
@@ -58,6 +60,16 @@ def testCythonConvertList(self): |
58 | 60 | ) |
59 | 61 | self.assertEqual(expected[0][0], result[0][0]) |
60 | 62 |
|
| 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 | + |
61 | 73 | def testConvertBNG(self): |
62 | 74 | """Test multithreaded BNG --> lon, lat function""" |
63 | 75 | expected = ([-0.32822654, -2.01831267], [51.44533145, 54.58910534]) |
|
0 commit comments