Skip to content

Commit

Permalink
Add assertions for boolean results.
Browse files Browse the repository at this point in the history
  • Loading branch information
edtechre committed Mar 25, 2023
1 parent 30b0e13 commit 175451f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ def test_set_pos_ctx_data(


def test_cancel_pending_order(ctx, pending_orders):
ctx.cancel_pending_order(pending_orders[0].id)
assert ctx.cancel_pending_order(pending_orders[0].id)
orders = tuple(ctx.pending_orders())
assert orders == tuple([pending_orders[1]])

Expand Down
2 changes: 1 addition & 1 deletion tests/test_portfolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -2760,7 +2760,7 @@ def test_remove_stop():
limit_price=None,
stops=stops,
)
portfolio.remove_stop(1)
assert portfolio.remove_stop(1)
portfolio.incr_bars()
portfolio.check_stops(DATE_2, price_scope)
assert len(portfolio.long_positions) == 1
Expand Down
2 changes: 1 addition & 1 deletion tests/test_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def test_fetch(self, price, expected_price):

class TestPendingOrderScope:
def test_remove(self, pending_orders, pending_order_scope):
pending_order_scope.remove(pending_orders[0].id)
assert pending_order_scope.remove(pending_orders[0].id)
orders = tuple(pending_order_scope.orders())
assert len(orders) == 1
assert orders[0] == pending_orders[1]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,7 @@ def exec_fn(ctx):
ctx.buy_shares = 100
ctx.stop_loss = 10
elif ctx.bars == 10:
ctx.cancel_stop(stop_id=1)
assert ctx.cancel_stop(stop_id=1)

df = data_source_df[data_source_df["symbol"] == "SPY"]
dates = df["date"].unique()
Expand Down

0 comments on commit 175451f

Please sign in to comment.