示例#1
0
def get_transactions_list():
    single_transaction = []  # [date, amount, description, category]
    transactions = []
    expenses = []
    income = []
    for row in range(date_dimensions[0] + 1, df.shape[0]):
        single_transaction.clear()
        if parse_transaction_date(df.loc[row, date_dimensions[1]]) is None:
            continue  # skip row if no date provided

        if not is_negative(df.loc[row, amount_dimensions[1]]):
            single_transaction.insert(
                0, parse_transaction_date(df.loc[row, date_dimensions[1]]))
            single_transaction.insert(1, df.loc[row, amount_dimensions[1]])
            single_transaction.insert(2, df.loc[row, desc_dimensions[1]])
            single_transaction.insert(3, 'testCateg')
            income.append(single_transaction.copy(
            ))  # positive transaction, so addition will be in Income
        else:
            single_transaction.insert(
                0, parse_transaction_date(df.loc[row, date_dimensions[1]]))
            single_transaction.insert(1, df.loc[row, amount_dimensions[1]])
            single_transaction.insert(2, df.loc[row, desc_dimensions[1]])
            single_transaction.insert(3, 'testCateg')
            expenses.append(single_transaction.copy(
            ))  # negative transaction, so addition will be in expense
    transactions.insert(0, expenses)
    transactions.insert(1, income)
    return transactions
示例#2
0
 def set_sign(self, val):
     self.clear(Flags.SIGN)
     if is_negative(val):
         self.set(Flags.SIGN)
示例#3
0
 def test_should_return_false_for_positive_numbers(self):
     self.assertFalse(utils.is_negative(56))
示例#4
0
 def test_should_return_false_for_zero(self):
     self.assertFalse(utils.is_negative(0))
示例#5
0
 def test_should_return_true_for_negative_numbers(self):
     self.assertTrue(utils.is_negative(-47))