Skip to content

Commit

Permalink
Test with non-utf8 csv encoding. (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
delucchi-cmu authored Nov 14, 2024
1 parent 6d44de7 commit a81b816
Showing 1 changed file with 12 additions and 0 deletions.
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

0 comments on commit a81b816

Please sign in to comment.