Skip to content

Conversation

nelly-hateva
Copy link
Collaborator

No description provided.

@nelly-hateva nelly-hateva requested a review from pgan002 October 3, 2025 10:51
@nelly-hateva nelly-hateva changed the title Statnett-142: Fix bug in the calculation of the aggregated results Statnett-142: Fix bug in the calculation of the aggregated results in case of an output from DESCRIBE query containing the string "results" Oct 3, 2025
Copy link
Collaborator

@pgan002 pgan002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 style suggestions

try:
res = json.loads(step["output"])
if "results" in res and "bindings" in res["results"]:
if isinstance(res, dict) and "results" in res.keys() and "bindings" in res["results"]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is enough:

Suggested change
if isinstance(res, dict) and "results" in res.keys() and "bindings" in res["results"]:
if isinstance(res, dict) and "results" in res and "bindings" in res["results"]:

We do not need to specify .keys().



def test_compute_aggregates_doesnt_throw_exception():
# The issue was that the actual SPARQL query is a DESCRIBE query containing the string "results" in the text.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# The issue was that the actual SPARQL query is a DESCRIBE query containing the string "results" in the text.
"""
Check that `compute_aggregates()` works when the actual SPARQL query
is a DESCRIBE query containing the string "results" in the text.
"""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants