|
8 | 8 | from spatialist import Vector |
9 | 9 | from sqlalchemy import Table, MetaData, Column, Integer, String |
10 | 10 | from geoalchemy2 import Geometry |
| 11 | +from shapely import wkt |
11 | 12 |
|
12 | 13 | metadata = MetaData() |
13 | 14 |
|
@@ -177,14 +178,16 @@ def test_archive(tmpdir, testdata): |
177 | 178 | assert len(out) == 1 |
178 | 179 | assert isinstance(out[0], str) |
179 | 180 |
|
180 | | - out = db.select(vv=1, return_value=['mindate', 'geometry_wkt']) |
| 181 | + out = db.select(vv=1, return_value=['mindate', 'geometry_wkt', 'geometry_wkb']) |
181 | 182 | assert len(out) == 1 |
182 | 183 | assert isinstance(out[0], tuple) |
183 | 184 | 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 |
188 | 191 |
|
189 | 192 | with pytest.raises(ValueError): |
190 | 193 | out = db.select(vv=1, return_value=['foobar']) |
@@ -214,9 +217,11 @@ def test_archive2(tmpdir, testdata): |
214 | 217 | assert not os.path.isfile(dbfile) |
215 | 218 | assert Vector(shp).nfeatures == 1 |
216 | 219 |
|
217 | | - with pytest.raises(OSError): |
218 | | - with pyroSAR.Archive(dbfile) as db: |
| 220 | + with pyroSAR.Archive(dbfile) as db: |
| 221 | + with pytest.raises(OSError): |
219 | 222 | db.import_outdated(testdata['archive_old_csv']) |
| 223 | + with pytest.raises(RuntimeError): |
| 224 | + db.import_outdated('foobar') |
220 | 225 |
|
221 | 226 | # the archive_old_bbox database contains a relative file name for the scene |
222 | 227 | # so that it can be reimported into the new database. The working directory |
|
0 commit comments