def test_known_ticker_and_unknown_ticker(transactions, capfd):
    """Testing capgains_show when providing a ticker not present in any
    transactions and a ticker that is present in a transaction
    """
    CapGainsShow.capgains_show(transactions, ['GOOGL', 'FB'])
    out, _ = capfd.readouterr()
    assert out == """\
def test_multiple_tickers(transactions, capfd):
    """Testing capgains_show when providing multiple tickers present in any
    transactions
    """
    CapGainsShow.capgains_show(transactions, ['ANET', 'GOOGL'])
    out, _ = capfd.readouterr()
    assert out == """\
def test_unknown_ticker(transactions, capfd):
    """Testing capgains_show when providing a ticker not present in any
    transactions
    """
    CapGainsShow.capgains_show(transactions, tickers=['FB'])
    out, _ = capfd.readouterr()
    assert out == """\
def test_no_filter(transactions, capfd):
    """Testing capgains_show without any filters"""
    CapGainsShow.capgains_show(transactions)
    out, _ = capfd.readouterr()
    assert out == """\
def test_ticker(transactions, capfd):
    """Testing capgains_show when providing a ticker filter"""
    CapGainsShow.capgains_show(transactions, tickers=['ANET'])
    out, _ = capfd.readouterr()
    assert out == """\
def test_no_transactions(capfd):
    """Testing capgains_show without any transactions"""
    CapGainsShow.capgains_show(Transactions([]))
    out, _ = capfd.readouterr()
    assert out == """\
Ejemplo n.º 7
0
def show(transactions_csv, tickers):
    transactions = TransactionsReader.get_transactions(transactions_csv)
    capgains_show(transactions, tickers)