Skip to content
Open
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
22 changes: 22 additions & 0 deletions sdks/python/pmxt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
22 changes: 22 additions & 0 deletions sdks/python/tests/test_public_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down