Skip to content

Commit acee11b

Browse files
committed
Very small fix
1 parent fefcd80 commit acee11b

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

opencosmo/link/collection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(
5858
self.__filters = filters
5959

6060
def __repr__(self):
61-
structure_type = self.header.file.data_type.split("_")[0] + "s"
61+
structure_type = self.__header.file.data_type.split("_")[0] + "s"
6262
dtype_str = ", ".join(self.__handlers.keys())
6363
return f"Collection of {structure_type} with linked datasets {dtype_str}"
6464

opencosmo/link/io.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ def open_linked_files(*files: Path):
9292
Open a collection of files that are linked together, such as a
9393
properties file and a particle file.
9494
"""
95+
if len(files) == 1 and isinstance(files[0], list):
96+
return open_linked_files(*files[0])
97+
98+
9599
file_handles = [File(file, "r") for file in files]
96100
headers = [read_header(file) for file in file_handles]
97101
properties_file, linked_files = verify_links(*headers)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "opencosmo"
3-
version = "0.6.0"
3+
version = "0.6.1"
44
description = "OpenCosmo Python Toolkit"
55
authors = ["Patrick Wells <pwells@anl.gov>"]
66
readme = "README.md"

test/test_collection.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ def test_multi_filter(multi_path):
4242
for ds in collection.values():
4343
assert all(ds.data["sod_halo_mass"] > 0)
4444

45+
def test_multi_repr(multi_path):
46+
collection = oc.read(multi_path)
47+
assert isinstance(collection.__repr__(), str)
4548

4649
def test_multi_filter_write(multi_path, tmp_path):
4750
collection = oc.read(multi_path)
@@ -85,6 +88,11 @@ def test_data_linking(halo_paths):
8588
assert n_particles > 0
8689
assert n_profiles > 0
8790

91+
def test_data_link_repr(halo_paths):
92+
collection = open_linked_files(halo_paths)
93+
assert isinstance(collection.__repr__(), str)
94+
95+
8896

8997
def test_data_link_selection(halo_paths):
9098
collection = open_linked_files(*halo_paths)

test/test_read.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ def test_all_columns_included(input_path):
3434
def test_read_multi(multi_path):
3535
dataset = oc.read(multi_path)
3636
assert isinstance(dataset, oc.collection.collection.SimulationCollection)
37+
38+
def test_dataset_repr(input_path):
39+
dataset = oc.read(input_path)
40+
assert isinstance(dataset.__repr__(), str)

0 commit comments

Comments
 (0)