def test_should_get_highest_and_lowest_bids_when_auction_has_three_bids(self): jeff = User('Jefferson') jorgita = User('Jorgita') bid_jeff = Bid(jeff, 150) bid_jorgita = Bid(jorgita, 200) self.auction.place_bid(self.bid_jorge) self.auction.place_bid(bid_jeff) self.auction.place_bid(bid_jorgita) self.assertEqual(200, self.auction.highest_bid) self.assertEqual(100, self.auction.lowest_bid)
def test_auction(): jorge = User('Jorge') jeff = User('Jefferson') bid_jorge = Bid(jorge, 100) bid_jeff = Bid(jeff, 150) auction = Auction('Cellphone') auction.bids.append(bid_jorge) auction.bids.append(bid_jeff) for bid in auction.bids: print(f'User {bid.user.name} has a bid of {bid.value}')
def test_inspector(): jorge = User('Jorge') jeff = User('Jefferson') bid_jorge = Bid(jorge, 100) bid_jeff = Bid(jeff, 150) auction = Auction('Cellphone') auction.bids.append(bid_jorge) auction.bids.append(bid_jeff) inspector = Inspector() inspector.inspect(auction) print(f'Highest bid: {inspector.highest_bid}, Lowest bid: {inspector.lowest_bid}')
def test_should_place_bids_when_added_in_ascending_order(self): jeff = User('Jefferson') bid_jeff = Bid(jeff, 150) self.auction.place_bid(self.bid_jorge) self.auction.place_bid(bid_jeff) self.assertEqual(2, len(self.auction.bids))
def test_should_place_bid_when_current_and_previous_user_are_different(self): jeff = User('Jefferson') bid_jeff = Bid(jeff, 150) self.auction.place_bid(self.bid_jorge) self.auction.place_bid(bid_jeff) self.assertEqual(2, len(self.auction.bids))
def test_should_get_highest_and_lowest_bids_when_added_in_ascending_order(self): jeff = User('Jefferson') bid_jeff = Bid(jeff, 150) self.auction.place_bid(self.bid_jorge) self.auction.place_bid(bid_jeff) self.assertEqual(150, self.auction.highest_bid) self.assertEqual(100, self.auction.lowest_bid)
def setUp(self): self.jorge = User('Jorge') self.bid_jorge = Bid(self.jorge, 100) self.auction = Auction('Cellphone')
def test_should_not_place_bids_when_added_in_descending_order(self): with self.assertRaises(InvalidBid): jeff = User('Jefferson') bid_jeff = Bid(jeff, 150) self.auction.place_bid(bid_jeff) self.auction.place_bid(self.bid_jorge)
def jorge(): return User("Jorge", 100)