Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def testReadAccount(self):
with open_file('tiaacref.ofx') as f:
ofx = OfxParser.parse(f)
self.assertTrue(hasattr(ofx, 'account'))
self.assertTrue(hasattr(ofx.account, 'account_id'))
self.assertEqual(ofx.account.account_id, '111A1111 22B222 33C333')
self.assertTrue(hasattr(ofx.account, 'type'))
self.assertEqual(ofx.account.type, AccountType.Investment)
"""
description = data.desc if hasattr(data, 'desc') else None
if data.type == AccountType.Bank:
return BankAccount(
institution=institution,
number=data.account_id,
routing_number=data.routing_number,
account_type=data.account_type,
description=description)
elif data.type == AccountType.CreditCard:
return CreditCardAccount(
institution=institution,
number=data.account_id,
description=description)
elif data.type == AccountType.Investment:
return BrokerageAccount(
institution=institution,
number=data.account_id,
broker_id=data.brokerid,
description=description)
raise ValueError("unknown account type: %s" % data.type)