Skip to content

Commit 28d255b

Browse files
committed
update tests for hdf5 2.0
1 parent d8fb5d7 commit 28d255b

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

test/h5cpp_tests/node_tests/link_iteration_test.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ def test_direct_iteration(self):
8888

8989
links = [link.path.name for link in entry.links]
9090

91-
self.assertListEqual(links, ["data", "instrument", "sample"],
92-
"Comparison of link names {}".format(links))
91+
self.assertSetEqual(set(links),
92+
set(["data", "instrument", "sample"]),
93+
"Comparison of link names {}".format(links))
9394

9495
def test_recursive_iteration(self):
9596

@@ -104,5 +105,5 @@ def test_recursive_iteration(self):
104105
"detector_module_2",
105106
"detector_module_3",
106107
"sample"]
107-
self.assertListEqual(links, refnames,
108-
"Comparison of link names {}".format(links))
108+
self.assertSetEqual(set(links), set(refnames),
109+
"Comparison of link names {}".format(links))

test/h5cpp_tests/node_tests/node_iterator_test.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ def test_immediate_children_iteration(self):
109109

110110
nodes = [node.link.path.name for node in entry.nodes]
111111
refnames = ["data", "instrument", "sample"]
112-
self.assertListEqual(nodes, refnames,
113-
"Comparison of node names: {}".format(nodes))
112+
self.assertSetEqual(set(nodes), set(refnames),
113+
"Comparison of node names: {}".format(nodes))
114114

115115
def test_recursive_node_iteration(self):
116116

@@ -123,8 +123,15 @@ def test_recursive_node_iteration(self):
123123
h5cpp.Path("/entry/instrument/detector_2"),
124124
h5cpp.Path("/entry/instrument/detector_2/data")
125125
]
126-
self.assertListEqual(
127-
node_paths, paths, "Path comparison: {}".format(node_paths))
126+
self.assertEqual(
127+
len(paths), len(node_paths),
128+
"Number of links comparison: {} == {}".format(len(paths),
129+
len(node_paths)))
130+
131+
for path in paths:
132+
self.assertTrue(
133+
path in node_paths,
134+
"Path comparison: {} in {}".format(path, node_paths))
128135

129136
def test_exists(self):
130137

0 commit comments

Comments
 (0)