Address code review feedback: fix test logic and correct misleading comment

Co-authored-by: jpawlowski <75446+jpawlowski@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-01 01:25:17 +00:00
parent 568fb219f2
commit b790ee1f6c
2 changed files with 9 additions and 6 deletions

View file

@ -404,7 +404,7 @@ async def handle_chartdata(call: ServiceCall) -> dict[str, Any]: # noqa: PLR091
chart_data.append(connect_point)
else:
# Price goes UP or stays same: Add hold point with current price
# Then add connect point at next level with higher price
# This extends the current level to the boundary before the gap
hold_point = {
start_time_field: next_start_serialized,
price_field: converted_price,

View file

@ -79,10 +79,12 @@ class TestConnectSegmentsOutput:
next_price = 0.12
# With connect_segments=True and price going down:
# The transition point should use next_price (lower price)
transition_price = min(current_price, next_price)
# The transition point should use next_price (the lower price)
# This draws the line downward from current segment level
is_price_going_down = next_price < current_price
transition_price = next_price # Use next price when going down
assert transition_price == next_price
assert is_price_going_down, "Price should be going down"
assert transition_price == 0.12
def test_transition_point_up_has_current_price(self) -> None:
@ -96,9 +98,10 @@ class TestConnectSegmentsOutput:
# With connect_segments=True and price going up:
# The hold point should use current_price (extend current level)
hold_price = min(current_price, next_price)
is_price_going_up = next_price >= current_price
hold_price = current_price # Extend current level when going up
assert hold_price == current_price
assert is_price_going_up, "Price should be going up"
assert hold_price == 0.11