How to use the ofxparse.ofxparse.soup_maker function in ofxparse

To help you get started, we’ve selected a few ofxparse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jseutter / ofxparse / tests / test_parse.py View on Github external
def testThatParseTransactionWithDotAsDecimalPointAndCommaAsSeparator(self):
        " The exact opposite of the previous test.  Why are numbers so hard?"
        input = '''

 POS
 20090401122017.000[-5:EST]
 -1,006.60
 0000123456782009040100001
 MCDONALD'S #112
 POS MERCHANDISE;MCDONALD'S #112

'''
        txn = soup_maker(input)
        transaction = OfxParser.parseTransaction(txn.find('stmttrn'))
        self.assertEqual(Decimal('-1006.60'), transaction.amount)
github jseutter / ofxparse / tests / test_parse.py View on Github external
def testThatReturnedAccountAlsoHasAStatement(self):
        stmtrs = soup_maker(self.input)
        account = OfxParser.parseStmtrs(
            stmtrs.find('stmtrs'), AccountType.Bank)[0]
        self.assertTrue(hasattr(account, 'statement'))
github jseutter / ofxparse / tests / test_parse.py View on Github external
def testThatParseTransactionWithCommaAsDecimalPoint(self):
        input = '''

 POS
 20090401122017.000[-5:EST]
 -1006,60
 0000123456782009040100001
 MCDONALD'S #112
 POS MERCHANDISE;MCDONALD'S #112

'''
        txn = soup_maker(input)
        transaction = OfxParser.parseTransaction(txn.find('stmttrn'))
        self.assertEqual(Decimal('-1006.60'), transaction.amount)
github jseutter / ofxparse / tests / test_parse.py View on Github external
def testThatParseTransactionReturnsATransaction(self):
        input = '''

 POS
 20090131
 20090401122017.000[-5:EST]
 -6.60
 0000123456782009040100001
 MCDONALD'S #112
 POS MERCHANDISE;MCDONALD'S #112

'''
        txn = soup_maker(input)
        transaction = OfxParser.parseTransaction(txn.find('stmttrn'))
        self.assertEqual('pos', transaction.type)
        self.assertEqual(datetime(
            2009, 4, 1, 12, 20, 17) - timedelta(hours=-5), transaction.date)
        self.assertEqual(datetime(2009, 1, 31, 0, 0), transaction.user_date)
        self.assertEqual(Decimal('-6.60'), transaction.amount)
        self.assertEqual('0000123456782009040100001', transaction.id)
        self.assertEqual("MCDONALD'S #112", transaction.payee)
        self.assertEqual("POS MERCHANDISE;MCDONALD'S #112", transaction.memo)
github jseutter / ofxparse / tests / test_parse.py View on Github external
Some banks use a null transaction to include interest
        rate changes on statements.
        """
        input_template = '''

 DEP
 20130306
 {amount}
 2013030601009100
 700
 DEPOSITO ONLINE

'''
        for amount in ("null", "-null"):
            input = input_template.format(amount=amount)
            txn = soup_maker(input)

            transaction = OfxParser.parseTransaction(txn.find('stmttrn'))

            self.assertEqual(0, transaction.amount)
github jseutter / ofxparse / tests / test_parse.py View on Github external
def testThatParseStmtrsReturnsAnAccount(self):
        stmtrs = soup_maker(self.input)
        account = OfxParser.parseStmtrs(
            stmtrs.find('stmtrs'), AccountType.Bank)[0]
        self.assertEqual('12300 000012345678', account.number)
        self.assertEqual('160000100', account.routing_number)
        self.assertEqual('CHECKING', account.account_type)
github jseutter / ofxparse / tests / test_parse.py View on Github external
MCDONALD'S #112
    POS MERCHANDISE;MCDONALD'S #112
   
  
  
   382.34
   20090523122017
  
  
   682.34
   20090523122017
  
 

        '''
        txn = soup_maker(input)
        statement = OfxParser.parseStatement(txn.find('stmttrnrs'))
        self.assertEqual(None, statement.start_date)
        self.assertEqual(None, statement.end_date)
        self.assertEqual(1, len(statement.transactions))
        self.assertEqual(Decimal('382.34'), statement.balance)
        self.assertEqual(datetime(2009, 5, 23, 12, 20, 17), statement.balance_date)
        self.assertEqual(Decimal('682.34'), statement.available_balance)
        self.assertEqual(datetime(2009, 5, 23, 12, 20, 17), statement.available_balance_date)
github jseutter / ofxparse / tests / test_parse.py View on Github external
MCDONALD'S #112
    POS MERCHANDISE;MCDONALD'S #112
   
  
  
   382.34
   20090523122017
  
  
   682.34
   20090523122017
  
 

        '''
        txn = soup_maker(input)
        statement = OfxParser.parseStatement(txn.find('stmttrnrs'))
        self.assertEqual(datetime(2009, 4, 1), statement.start_date)
        self.assertEqual(
            datetime(2009, 5, 23, 12, 20, 17), statement.end_date)
        self.assertEqual(1, len(statement.transactions))
        self.assertEqual(Decimal('382.34'), statement.balance)
        self.assertEqual(datetime(2009, 5, 23, 12, 20, 17), statement.balance_date)
        self.assertEqual(Decimal('682.34'), statement.available_balance)
        self.assertEqual(datetime(2009, 5, 23, 12, 20, 17), statement.available_balance_date)
github jseutter / ofxparse / tests / test_parse.py View on Github external
def testThatParseTransactionWithCommaAsDecimalPointAndDotAsSeparator(self):
        input = '''

 POS
 20090401122017.000[-5:EST]
 -1.006,60
 0000123456782009040100001
 MCDONALD'S #112
 POS MERCHANDISE;MCDONALD'S #112

'''
        txn = soup_maker(input)
        transaction = OfxParser.parseTransaction(txn.find('stmttrn'))
        self.assertEqual(Decimal('-1006.60'), transaction.amount)
github jseutter / ofxparse / tests / test_parse.py View on Github external
def testThatParseTransactionWithFieldCheckNum(self):
        input = '''

 DEP
 20130306
 1000.00
 2013030601009100
 700
 DEPOSITO ONLINE

'''
        txn = soup_maker(input)
        transaction = OfxParser.parseTransaction(txn.find('stmttrn'))
        self.assertEqual('700', transaction.checknum)