def test_create_bid(self): import datetime ask = ob.create_bid(1, 1, datetime.datetime.now()) assert_equal(ask['type'], 'bid') assert_equal(ask['price'], 1) assert_equal(ask['quantity'], 1) assert_equal(len(ob.offers), 1)
def test_create_bid(self): import datetime ask = ob.create_bid(1, 1, datetime.datetime.now()) assert_equal(ask["type"], "bid") assert_equal(ask["price"], 1) assert_equal(ask["quantity"], 1) assert_equal(len(ob.offers), 1)
def test_highest_offer(self): ob.create_bid(1, 1, next_year) bid2 = ob.create_bid(2, 1, next_year) highest_offer = ob.highest_offer(ob.offers) assert_equal(highest_offer, bid2)
def test_match_incoming_ask_without_a_match(self): ob.create_bid(11, 1, next_year) their_ask = ob.create_ask(12, 1, next_year) their_ask["id"] = 1234 matching_bid = ob.match_incoming_ask(their_ask) assert_is(matching_bid, None)
def test_match_incoming_ask(self): own_bid = ob.create_bid(12, 1, next_year) their_ask = ob.create_ask(11, 1, next_year) their_ask["id"] = 1234 matching_bid = ob.match_incoming_ask(their_ask) assert_is(matching_bid, own_bid)
def test_match_ask_without_a_match(self): own_ask = ob.create_ask(11, 1, next_year) their_bid = ob.create_bid(10, 1, next_year) their_bid["id"] = 1234 matching_bid = ob.match_ask(own_ask) assert_is_none(matching_bid)
def test_match_bid(self): own_bid = ob.create_bid(11, 1, next_year) their_ask = ob.create_ask(10, 1, next_year) their_ask["id"] = 1234 matching_ask = ob.match_bid(own_bid) assert_is(matching_ask, their_ask)
def test_get_own_bids(self): bid = ob.create_bid(1, 1, next_year) bids = ob.get_own_bids() assert_equal(bids, [bid])
def test_match_incoming_ask_without_a_match(self): ob.create_bid(11, 1, next_year) their_ask = ob.create_ask(12, 1, next_year) their_ask['id'] = 1234 matching_bid = ob.match_incoming_ask(their_ask) assert_is(matching_bid, None)
def test_match_incoming_ask(self): own_bid = ob.create_bid(12, 1, next_year) their_ask = ob.create_ask(11, 1, next_year) their_ask['id'] = 1234 matching_bid = ob.match_incoming_ask(their_ask) assert_is(matching_bid, own_bid)
def test_match_ask_without_a_match(self): own_ask = ob.create_ask(11, 1, next_year) their_bid = ob.create_bid(10, 1, next_year) their_bid['id'] = 1234 matching_bid = ob.match_ask(own_ask) assert_is_none(matching_bid)
def test_match_bid(self): own_bid = ob.create_bid(11, 1, next_year) their_ask = ob.create_ask(10, 1, next_year) their_ask['id'] = 1234 matching_ask = ob.match_bid(own_bid) assert_is(matching_ask, their_ask)