File tree Expand file tree Collapse file tree 5 files changed +18
-2
lines changed Expand file tree Collapse file tree 5 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ def __init__(
58
58
self .__filters = filters
59
59
60
60
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"
62
62
dtype_str = ", " .join (self .__handlers .keys ())
63
63
return f"Collection of { structure_type } with linked datasets { dtype_str } "
64
64
Original file line number Diff line number Diff line change @@ -92,6 +92,10 @@ def open_linked_files(*files: Path):
92
92
Open a collection of files that are linked together, such as a
93
93
properties file and a particle file.
94
94
"""
95
+ if len (files ) == 1 and isinstance (files [0 ], list ):
96
+ return open_linked_files (* files [0 ])
97
+
98
+
95
99
file_handles = [File (file , "r" ) for file in files ]
96
100
headers = [read_header (file ) for file in file_handles ]
97
101
properties_file , linked_files = verify_links (* headers )
Original file line number Diff line number Diff line change 1
1
[tool .poetry ]
2
2
name = " opencosmo"
3
- version = " 0.6.0 "
3
+ version = " 0.6.1 "
4
4
description = " OpenCosmo Python Toolkit"
5
5
authors = [" Patrick Wells <pwells@anl.gov>" ]
6
6
readme = " README.md"
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ def test_multi_filter(multi_path):
42
42
for ds in collection .values ():
43
43
assert all (ds .data ["sod_halo_mass" ] > 0 )
44
44
45
+ def test_multi_repr (multi_path ):
46
+ collection = oc .read (multi_path )
47
+ assert isinstance (collection .__repr__ (), str )
45
48
46
49
def test_multi_filter_write (multi_path , tmp_path ):
47
50
collection = oc .read (multi_path )
@@ -85,6 +88,11 @@ def test_data_linking(halo_paths):
85
88
assert n_particles > 0
86
89
assert n_profiles > 0
87
90
91
+ def test_data_link_repr (halo_paths ):
92
+ collection = open_linked_files (halo_paths )
93
+ assert isinstance (collection .__repr__ (), str )
94
+
95
+
88
96
89
97
def test_data_link_selection (halo_paths ):
90
98
collection = open_linked_files (* halo_paths )
Original file line number Diff line number Diff line change @@ -34,3 +34,7 @@ def test_all_columns_included(input_path):
34
34
def test_read_multi (multi_path ):
35
35
dataset = oc .read (multi_path )
36
36
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 )
You can’t perform that action at this time.
0 commit comments