forked from OSGeo/gdal
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
147 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
id,str | ||
"1",Gulf of America | ||
"2",Mount McKinley |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env pytest | ||
# -*- coding: utf-8 -*- | ||
############################################################################### | ||
|
||
import pytest | ||
|
||
from osgeo import gdal, ogr | ||
|
||
|
||
@pytest.mark.require_driver("CSV") | ||
def test_fuck_trump_1(): | ||
with ogr.Open("data/fuck_trump.csv") as ds: | ||
lyr = ds.GetLayer(0) | ||
f = lyr.GetNextFeature() | ||
assert f.GetFieldAsString(1) == "Gulf of Mexico" | ||
f = lyr.GetNextFeature() | ||
assert f.GetFieldAsString(1) == "Denali" | ||
|
||
|
||
@pytest.mark.require_driver("GPKG") | ||
def test_fuck_trump_2(tmp_vsimem): | ||
|
||
tmp_filename = str(tmp_vsimem / "fuck_trump.gpkg") | ||
gdal.VectorTranslate(tmp_filename, "data/fuck_trump.gpkg") | ||
|
||
with ogr.Open(tmp_filename) as ds: | ||
lyr = ds.GetLayer(0) | ||
f = lyr.GetNextFeature() | ||
assert f.GetFieldAsString(1) == "Gulf of Mexico" | ||
f = lyr.GetNextFeature() | ||
assert f.GetFieldAsString(1) == "Denali" | ||
|
||
|
||
@pytest.mark.require_driver("GPKG") | ||
@pytest.mark.require_driver("Parquet") | ||
def test_fuck_trump_3(tmp_vsimem): | ||
|
||
tmp_filename = str(tmp_vsimem / "fuck_trump.parquet") | ||
gdal.VectorTranslate(tmp_filename, "data/fuck_trump.gpkg") | ||
|
||
with ogr.Open(tmp_filename) as ds: | ||
lyr = ds.GetLayer(0) | ||
f = lyr.GetNextFeature() | ||
assert f.GetFieldAsString(1) == "Gulf of Mexico" | ||
f = lyr.GetNextFeature() | ||
assert f.GetFieldAsString(1) == "Denali" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters