Skip to content
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
4 changes: 4 additions & 0 deletions sdks/python/pmxt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
Position,
Balance,
MarketFilterCriteria,
MarketFilterFunction,
EventFilterCriteria,
EventFilterFunction,
MarketFetchParams,
EventFetchParams,
SeriesFetchParams,
Expand Down Expand Up @@ -255,7 +257,9 @@ def restart_server() -> None:
"FetchMatchedMarketClustersParams",
"FetchMatchedEventClustersParams",
"MarketFilterCriteria",
"MarketFilterFunction",
"EventFilterCriteria",
"EventFilterFunction",
"MarketFetchParams",
"EventFetchParams",
"SeriesFetchParams",
Expand Down
28 changes: 28 additions & 0 deletions sdks/python/tests/test_public_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,34 @@ def test_websocket_return_types_are_public_exports():
assert expected <= public_exports


def test_filter_function_types_are_public_exports():
init_path = Path(__file__).resolve().parents[1] / "pmxt" / "__init__.py"
tree = ast.parse(init_path.read_text(encoding="utf-8"))

imported_models = set()
public_exports = set()

for node in tree.body:
if isinstance(node, ast.ImportFrom) and node.module == "models":
imported_models.update(alias.name for alias in node.names)
elif (
isinstance(node, ast.Assign)
and len(node.targets) == 1
and isinstance(node.targets[0], ast.Name)
and node.targets[0].id == "__all__"
and isinstance(node.value, ast.List)
):
public_exports.update(
item.value
for item in node.value.elts
if isinstance(item, ast.Constant) and isinstance(item.value, str)
)

expected = {"MarketFilterFunction", "EventFilterFunction"}
assert expected <= imported_models
assert expected <= public_exports


def test_fetch_order_book_params_shape_matches_typescript_sdk():
models_path = Path(__file__).resolve().parents[1] / "pmxt" / "models.py"
tree = ast.parse(models_path.read_text(encoding="utf-8"))
Expand Down
Loading