Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete get_edges_under_consolidation #930

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TM1py/Services/ElementService.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ def get_edges(sub_trees):
edges[sub_tree["ParentName"], sub_tree["ComponentName"]] = sub_tree["Weight"]

if "Edges" not in sub_tree["Component"]:
return
continue

get_edges(sub_trees=sub_tree["Component"]["Edges"])

Expand Down
11 changes: 11 additions & 0 deletions Tests/ElementService_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,17 @@ def test_get_edges_under_consolidation_max_depth_1(self):
self.assertEqual(1, len(edges))
self.assertEqual(1, edges["All Consolidations", "Total Years"])

def test_get_edges_under_consolidation_max_depth_1_with_n_components(self):
edges = self.tm1.dimensions.hierarchies.elements.get_edges_under_consolidation(
self.dimension_name,
self.hierarchy_name,
"Total Years",
max_depth=1)

self.assertEqual(len(self.years), len(edges))
for year in self.years:
self.assertEqual(1, edges["Total Years", year])

def test_get_edges_under_consolidation_not_existing_consolidation(self):
with self.assertRaises(TM1pyRestException) as _:
self.tm1.dimensions.hierarchies.elements.get_edges_under_consolidation(
Expand Down