From cc4610c30550c7867ebafd22946b9b531e5bbb3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antons=20Brains=20B=C4=81rdi=C5=86=C5=A1?= <209032857+AntonsBB@users.noreply.github.com> Date: Wed, 22 Jul 2026 19:43:55 +0300 Subject: [PATCH] fix(python): export hosted trading errors --- sdks/python/pmxt/__init__.py | 22 ++++++++++++++++++++++ sdks/python/tests/test_public_exports.py | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/sdks/python/pmxt/__init__.py b/sdks/python/pmxt/__init__.py index 7c792ec3..c90cf9d6 100644 --- a/sdks/python/pmxt/__init__.py +++ b/sdks/python/pmxt/__init__.py @@ -40,6 +40,18 @@ NetworkError, ExchangeNotAvailable, ) +from ._hosted_errors import ( + HostedTradingError, + InsufficientEscrowBalance, + OrderSizeTooSmall, + InvalidApiKey, + OutcomeNotFound, + CatalogUnavailable, + BuiltOrderExpired, + InvalidSignature, + NoLiquidity, + MissingWalletAddress, +) from .models import ( UnifiedMarket, UnifiedEvent, @@ -225,6 +237,16 @@ def restart_server() -> None: "ValidationError", "NetworkError", "ExchangeNotAvailable", + "HostedTradingError", + "InsufficientEscrowBalance", + "OrderSizeTooSmall", + "InvalidApiKey", + "OutcomeNotFound", + "CatalogUnavailable", + "BuiltOrderExpired", + "InvalidSignature", + "NoLiquidity", + "MissingWalletAddress", # Data Models "UnifiedMarket", "UnifiedEvent", diff --git a/sdks/python/tests/test_public_exports.py b/sdks/python/tests/test_public_exports.py index 2fdb3236..1c3deeaf 100644 --- a/sdks/python/tests/test_public_exports.py +++ b/sdks/python/tests/test_public_exports.py @@ -2,6 +2,28 @@ from pathlib import Path +def test_hosted_trading_errors_are_top_level_public_exports(): + import pmxt + from pmxt import _hosted_errors + + hosted_error_names = { + "HostedTradingError", + "InsufficientEscrowBalance", + "OrderSizeTooSmall", + "InvalidApiKey", + "OutcomeNotFound", + "CatalogUnavailable", + "BuiltOrderExpired", + "InvalidSignature", + "NoLiquidity", + "MissingWalletAddress", + } + + assert hosted_error_names <= set(pmxt.__all__) + for name in hosted_error_names: + assert getattr(pmxt, name) is getattr(_hosted_errors, name) + + def test_websocket_return_types_are_public_exports(): init_path = Path(__file__).resolve().parents[1] / "pmxt" / "__init__.py" tree = ast.parse(init_path.read_text(encoding="utf-8"))