From 9c1e7a919dd61998dafa2790585cb4a24b7f89aa Mon Sep 17 00:00:00 2001 From: rcholic Date: Sat, 20 Jul 2024 16:48:18 -0700 Subject: [PATCH] Make SessionHours optional --- cschwabpy/models/__init__.py | 2 +- tests/test_models.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cschwabpy/models/__init__.py b/cschwabpy/models/__init__.py index 29d6f84..6459efa 100644 --- a/cschwabpy/models/__init__.py +++ b/cschwabpy/models/__init__.py @@ -203,7 +203,7 @@ class Market(JSONSerializableBaseModel): product: str productName: str isOpen: bool - sessionHours: SessionHours + sessionHours: Optional[SessionHours] = None class EquityMarket(JSONSerializableBaseModel): diff --git a/tests/test_models.py b/tests/test_models.py index de566ad..d20ee5b 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -97,6 +97,7 @@ async def test_market_hours(httpx_mock: HTTPXMock) -> None: all_market = MarketHourInfo(**all_market_json) assert all_market is not None assert all_market.equity is not None + assert all_market.equity.EQ.sessionHours is not None assert all_market.equity.EQ.sessionHours.regularMarket is not None assert all_market.equity.EQ.sessionHours.preMarket is not None