Skip to content

Commit

Permalink
TST: ignore pygrio default int32 type (#626)
Browse files Browse the repository at this point in the history
  • Loading branch information
bifbof authored Jun 30, 2024
1 parent 8916306 commit 3308ef9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion tests/io/test_dataset_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ def test_simple_input(self):
"user_id": [0, 0, 0],
}
pfs_test = Positionfixes(data, geometry="geometry", crs=4326)
assert_geodataframe_equal(pfs, pfs_test)
# ignore dtypes as gpd.read_file defaults to i32 while pd.DataFrame defaults to i64
assert_geodataframe_equal(pfs, pfs_test, check_dtype=False)

def test_missing_files(self):
"""Test if useful message is output if directory has no gpx files"""
Expand Down
12 changes: 8 additions & 4 deletions tests/io/test_from_geopandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ def test_csv(self):
pfs_from_csv = ti.read_positionfixes_csv(pfs_file, sep=";", tz="utc", index_col="id", crs="EPSG:4326")
pfs_from_csv = pfs_from_csv.rename(columns={"geom": "geometry"})

assert_frame_equal(pfs_from_gpd, pfs_from_csv, check_exact=False)
# ignore dtypes as gpd.read_file defaults to i32 while pd.read_csv defaults to i64
assert_frame_equal(pfs_from_gpd, pfs_from_csv, check_dtype=False, check_index_type=False)

def test_mapper(self, example_positionfixes):
"""Test if mapper argument allows for additional renaming."""
Expand Down Expand Up @@ -163,7 +164,8 @@ def test_csv(self):
tpls_from_csv = ti.read_triplegs_csv(tpls_file, sep=";", tz="utc", index_col="id")
tpls_from_csv = tpls_from_csv.rename(columns={"geom": "geometry"})

assert_frame_equal(tpls_from_gpd, tpls_from_csv, check_exact=False)
# ignore dtypes as gpd.read_file defaults to i32 while pd.read_csv defaults to i64
assert_frame_equal(tpls_from_gpd, tpls_from_csv, check_dtype=False, check_index_type=False)

def test_mapper(self):
"""Test if mapper argument allows for additional renaming."""
Expand Down Expand Up @@ -198,7 +200,8 @@ def test_csv(self):
sp_from_csv = ti.read_staypoints_csv(sp_file, sep=";", tz="utc", index_col="id")
sp_from_csv = sp_from_csv.rename(columns={"geom": "geometry"})

assert_frame_equal(sp_from_gpd, sp_from_csv, check_exact=False)
# ignore dtypes as gpd.read_file defaults to i32 while pd.read_csv defaults to i64
assert_frame_equal(sp_from_gpd, sp_from_csv, check_dtype=False, check_index_type=False)

def test_mapper(self):
"""Test if mapper argument allows for additional renaming."""
Expand Down Expand Up @@ -254,7 +257,8 @@ def test_csv(self):

# drop the second geometry column manually because not storable in GeoJSON (from Geopandas)
locs_from_csv = locs_from_csv.drop(columns="extent")
assert_frame_equal(locs_from_csv, locs_from_gpd, check_exact=False)
# ignore dtypes as gpd.read_file defaults to i32 while pd.read_csv defaults to i64
assert_frame_equal(locs_from_csv, locs_from_gpd, check_dtype=False, check_index_type=False)

def test_extent_col(self, example_locations):
"""Test function with optional geom-column "extent"."""
Expand Down

0 comments on commit 3308ef9

Please sign in to comment.