Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test with non-utf8 csv encoding. #48

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/hats/io/file_io/test_file_io_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from hats.io import paths
from hats.io.file_io import (
load_csv_to_pandas,
load_csv_to_pandas_generator,
load_text_file,
read_fits_image,
read_parquet_file_to_pandas,
Expand Down Expand Up @@ -39,6 +40,17 @@ def test_write_df_to_csv(tmp_cloud_path):
pd.testing.assert_frame_equal(loaded_df, random_df)


def test_load_csv_to_pandas_generator_encoding(tmp_cloud_path):
path = tmp_cloud_path / "koi8-r.csv"
with path.open(encoding="koi8-r", mode="w") as fh:
fh.write("col1,col2\nыыы,яяя\n")
num_reads = 0
for frame in load_csv_to_pandas_generator(path, chunksize=7, encoding="koi8-r"):
assert len(frame) == 1
num_reads += 1
assert num_reads == 1


def test_write_point_map_roundtrip(small_sky_dir_cloud, tmp_cloud_path):
"""Test the reading/writing of a catalog point map"""
expected_counts_skymap = read_fits_image(paths.get_point_map_file_pointer(small_sky_dir_cloud))
Expand Down