Skip to content

Commit

Permalink
Fix get omen market by id (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
kongzii authored Jun 26, 2024
1 parent bb0c765 commit 85d4cd0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,9 @@ def _parse_items_from_json(
for result_chunk in result:
for k, v in result_chunk.items():
# subgrounds might pack all items as a list, indexed by a key, or pack it as a dictionary (if one single element)
if isinstance(v, dict):
if v is None:
continue
elif isinstance(v, dict):
items.extend([v])
else:
items.extend(v)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "prediction-market-agent-tooling"
version = "0.39.2"
version = "0.39.3"
description = "Tools to benchmark, deploy and monitor prediction market agents."
authors = ["Gnosis"]
readme = "README.md"
Expand Down
6 changes: 6 additions & 0 deletions tests/markets/omen/test_omen_subgraph_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,3 +279,9 @@ def test_get_markets_id_in() -> None:
)
assert len(markets) == 1
assert markets[0].id == market_id


def test_omen_get_non_existing_market_by_id() -> None:
with pytest.raises(ValueError) as e:
OmenSubgraphHandler().get_omen_market_by_market_id(HexAddress(HexStr("0x123")))
assert "Fetched wrong number of markets. Expected 1 but got 0" in str(e)

0 comments on commit 85d4cd0

Please sign in to comment.