Closed rdsteed closed 7 years ago
It's a badly formed test. The relevant code in OfxParser.parse() is
stmtrs_ofx = ofx.findAll('stmtrs') if stmtrs_ofx: ofx_obj.accounts += cls_.parseStmtrs(stmtrs_ofx, AccountType.Bank)
...which passes in a list of stmtrs.
I can fix the test, or you can submit a fix if you'd be so inclined :)
Thanks for pointing this out!
Fix incorporated as part of Pull Request #96
I've written an extension to Beautiful Soup 4 (bs4) which I believe is much more robust at handling ofx formatted files than any of the various options currently available in Beautiful Soup 4. When I test it in ofxparse using nosetests, it passes all tests except
testThatParseStmtrsReturnsAnAccount
andtestThatReturnedAccountAlsoHasAStatement
.Both contain the line:
account = OfxParser.parseStmtrs(stmtrs.find('stmtrs'), AccountType.Bank)[0]
In looking at the definition of
parseStmtrs
, it appears the first argument (stmtrs_list) should be a list of stmtrs Tags rather than the single Tag returned bystmtrs.find('stmtrs')
. When I change the line to:account = OfxParser.parseStmtrs(stmtrs.find_all('stmtrs'), AccountType.Bank)[0]
,the tests work fine. I believe this is because because
stmtrs.find_all('stmtrs')
returns a list of stmtrs Tags as expected byparseStmtrs
.Is this a case of a malformed test lurking in the repository, or is it simply my thoughts that are malformed?