Exemplo n.º 1
0
    def test_prices_df(self, book_transactions):
        df = book_transactions.prices_df().reset_index()

        # remove guid columns as not comparable from run to run
        for col in df.columns:
            if "guid" in col:
                del df[col]

        # converte datetime to date as different tzone in CI environments
        df["date"] = df["date"].dt.date

        df_to_string = """   index        date         type      value commodity.mnemonic currency.mnemonic
0      0  2015-10-31  transaction   0.627907                EUR               USD
1      1  2015-10-29  transaction  30.833333       GnuCash Inc.               EUR
2      2  2015-11-01      unknown       1.23       GnuCash Inc.               USD
3      3  2015-11-02      unknown       2.34       GnuCash Inc.               EUR
4      4  2015-11-04      unknown       1.27       GnuCash Inc.               USD
5      5  2015-10-30  transaction   1.481481                USD               EUR"""

        assert df_to_string == df.to_string()
Exemplo n.º 2
0
    def test_prices_df(self, book_transactions):
        df = book_transactions.prices_df().reset_index()

        # remove guid columns as not comparable from run to run
        for col in df.columns:
            if "guid" in col:
                del df[col]

        # converte datetime to date as different tzone in CI environments
        df["date"] = df["date"].dt.date

        df_to_string = """   index        date         type      value commodity.mnemonic currency.mnemonic
0      0  2015-10-31  transaction   0.627907                EUR               USD
1      1  2015-10-29  transaction  30.833333       GnuCash Inc.               EUR
2      2  2015-11-01      unknown       1.23       GnuCash Inc.               USD
3      3  2015-11-02      unknown       2.34       GnuCash Inc.               EUR
4      4  2015-11-04      unknown       1.27       GnuCash Inc.               USD
5      5  2015-10-30  transaction   1.481481                USD               EUR"""

        assert df_to_string == df.to_string()