Esempio n. 1
0
    def test_importWalletTransactions_sametime(self):
        transactionsPath = get_data_path("transactions_bad_separator.csv")

        with codecs.open(transactionsPath,
                         'r',
                         encoding='utf-8',
                         errors='replace') as srcFile:
            importedData = parse_mb_transactions_data(srcFile)

        dataObject = DataObject()
        dataObject.importWalletTransactions(importedData)

        wallet: WalletData = dataObject.wallet
        self.assertEqual(wallet.size(), 1)

        trans: TransHistory = wallet["ENT"]
        amount = trans.currentAmount()
        self.assertEqual(amount, 0)
Esempio n. 2
0
    def test_importWalletTransactions(self):
        importedData = DataFrame({
            'trans_time': ['28.10.2020 09:10:07'],
            'name': ["CCC"],
            'k_s': ['S'],
            'amount': [10],
            'unit_price': ['10.2']
        })
        dataObject = DataObject()
        wallet: WalletData = dataObject.wallet
        self.assertEqual(wallet.size(), 0)

        dataObject.importWalletTransactions(importedData, True)
        self.assertEqual(wallet.size(), 1)

        trans: TransHistory = wallet["CCC"]
        self.assertEqual(len(trans), 1)
        self.assertEqual(trans[0][0], -10)

        dataObject.importWalletTransactions(importedData, True)

        self.assertEqual(wallet.size(), 1)
        self.assertEqual(len(trans), 1)
        self.assertEqual(trans[0][0], -10)