Skip to content

Commit cd406a4

Browse files
fixed and added tests
1 parent c77d8d8 commit cd406a4

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dependencies:
1616
- python>=3.8
1717
- pyyaml
1818
- requests
19+
- shapely
1920
- spatialist>=0.15.2
2021
- sqlalchemy>=1.4,<2.0
2122
- sqlalchemy-utils>=0.37

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ progressbar2
77
psycopg2
88
pyyaml
99
requests
10+
shapely
1011
spatialist>=0.15.2
1112
sqlalchemy>=1.4,<2.0
1213
sqlalchemy-utils>=0.37

tests/test_drivers.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from spatialist import Vector
99
from sqlalchemy import Table, MetaData, Column, Integer, String
1010
from geoalchemy2 import Geometry
11+
from shapely import wkt
1112

1213
metadata = MetaData()
1314

@@ -177,14 +178,16 @@ def test_archive(tmpdir, testdata):
177178
assert len(out) == 1
178179
assert isinstance(out[0], str)
179180

180-
out = db.select(vv=1, return_value=['mindate', 'geometry_wkt'])
181+
out = db.select(vv=1, return_value=['mindate', 'geometry_wkt', 'geometry_wkb'])
181182
assert len(out) == 1
182183
assert isinstance(out[0], tuple)
183184
assert out[0][0] == '20150222T170750'
184-
assert out[0][1] == ('POLYGON(('
185-
'8.505644 50.295261, 8.017178 51.788181, '
186-
'11.653832 52.183979, 12.0268 50.688881, '
187-
'8.505644 50.295261))')
185+
geom = wkt.loads('POLYGON(('
186+
'8.505644 50.295261, 12.0268 50.688881, '
187+
'11.653832 52.183979, 8.017178 51.788181, '
188+
'8.505644 50.295261))')
189+
assert wkt.loads(out[0][1]) == geom
190+
assert out[0][2] == geom.wkb
188191

189192
with pytest.raises(ValueError):
190193
out = db.select(vv=1, return_value=['foobar'])
@@ -214,9 +217,11 @@ def test_archive2(tmpdir, testdata):
214217
assert not os.path.isfile(dbfile)
215218
assert Vector(shp).nfeatures == 1
216219

217-
with pytest.raises(OSError):
218-
with pyroSAR.Archive(dbfile) as db:
220+
with pyroSAR.Archive(dbfile) as db:
221+
with pytest.raises(OSError):
219222
db.import_outdated(testdata['archive_old_csv'])
223+
with pytest.raises(RuntimeError):
224+
db.import_outdated('foobar')
220225

221226
# the archive_old_bbox database contains a relative file name for the scene
222227
# so that it can be reimported into the new database. The working directory

0 commit comments

Comments
 (0)