def test_sell(): p = Portfolio() p.buy("MSFT", 100, 27.0) p.buy("DELL", 100, 17.0) p.buy("ORCL", 100, 34.0) p.sell("MSFT", 50) assert p.cost() == 6450
def test_empty(): p = Portfolio() assert p.cost() == 0.0
def test_buy_two_stocks(): p = Portfolio() p.buy("IBM", 100, 176.48) p.buy("HPQ", 100, 36.15) assert p.cost() == 21263.0
def test_buy_one_stock(): p = Portfolio() p.buy("IBM", 100, 176.48) assert p.cost() == 17648.0