MCPcopy Create free account
hub / github.com/pydata/xarray / test_one_tree

Method test_one_tree

xarray/tests/test_treenode.py:308–339  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

306
307class TestGroupSubtrees:
308 def test_one_tree(self) -> None:
309 root, _ = create_test_tree()
310 expected_names = [
311 "a",
312 "b",
313 "c",
314 "d",
315 "e",
316 "h",
317 "f",
318 "g",
319 "i",
320 ]
321 expected_paths = [
322 ".",
323 "b",
324 "c",
325 "b/d",
326 "b/e",
327 "c/h",
328 "b/e/f",
329 "b/e/g",
330 "c/h/i",
331 ]
332 result_paths, result_names = zip(
333 *[(path, node.name) for path, (node,) in group_subtrees(root)], strict=False
334 )
335 assert list(result_names) == expected_names
336 assert list(result_paths) == expected_paths
337
338 result_names_ = [node.name for (node,) in zip_subtrees(root)]
339 assert result_names_ == expected_names
340
341 def test_different_order(self) -> None:
342 first: NamedNode = NamedNode(

Callers

nothing calls this directly

Calls 3

group_subtreesFunction · 0.90
zip_subtreesFunction · 0.90
create_test_treeFunction · 0.85

Tested by

no test coverage detected