Skip to content

[Python] Unit Tests for Client Wrapper (Mocks) #20

@realfishsam

Description

@realfishsam

Purpose / Goal

The Python SDK is currently tested primarily via integration tests against the live sidecar. We need isolated unit tests for client.py to ensure the data conversion logic (_convert_market, etc.) is robust against API changes.

Tasks

  • Create sdks/python/tests/test_converters.py.
  • Use pytest and \unittest.mock` to simulate the sidecar server's JSON responses.
  • Assert that the data models (UnifiedMarket, OrderBook) are correctly instantiated with the expected values.

Easy Way to Get Started

  1. Create a sample JSON file representing a market from the Polymarket API.
  2. In your test, pass this JSON to the _convert_market function in client.py.
  3. Check if attributes like market.title and market.yes.price match the JSON source.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomerspythonPython SDK specifictestingIssues related to tests

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions