Ejemplo n.º 1
0
def main():
    auction_house = AuctionHouse()

    guillaume = Participant("Guillaume")
    antonin = Participant("Antonin")

    painting_name = "Van Gogh's painting"
    painting = Item(painting_name, 1000)
    auction_painting = Auction(painting)

    auction_house.add_auction(auction_painting)
    # should fail - auction already added
    auction_house.add_auction(auction_painting)

    # auction has not been started yet
    guillaume.bid(auction_painting, 101)

    auction_painting.start()

    guillaume.bid(auction_painting, 101)
    antonin.bid(auction_painting, 999)
    # guillaume should bid more than 999
    guillaume.bid(auction_painting, 102)
    guillaume.bid(auction_painting, 1002)

    auction_painting.stop()

    logging.info(auction_house.latest_auction_by_item_name(painting_name))

    # should fail
    Auction(painting)

    # should fail
    auction_painting.start()
Ejemplo n.º 2
0
 def testLatestAuctionStartedWithoutBidder(self):
     auction = Auction(Item("Van Gogh's painting", 1000))
     self.auction_house.add_auction(auction)
     auction.start()
     logging.info(
         self.auction_house.latest_auction_by_item_name(
             "Van Gogh's painting"))
Ejemplo n.º 3
0
 def testLatestAuctionStartedWithBidder(self):
     auction = Auction(Item("Van Gogh's painting", 1000))
     self.auction_house.add_auction(auction)
     auction.start()
     guillaume = Participant("Guillaume")
     guillaume.bid(auction, 1001)
     logging.info(
         self.auction_house.latest_auction_by_item_name(
             "Van Gogh's painting"))
Ejemplo n.º 4
0
 def setUp(self):
     self.auction = Auction(Item("Van Gogh's painting", 1000))
Ejemplo n.º 5
0
 def testAddAuctionFailure(self):
     auction = Auction(Item("Van Gogh's painting", 1000))
     self.auction_house.add_auction(auction)
     self.auction_house.add_auction(auction)
     self.assertListEqual(self.auction_house.auctions, [auction])