jbms / beancount-import

Web UI for semi-automatically importing external data into beancount
GNU General Public License v2.0
392 stars 101 forks source link

Sort meta keys before printing to fix tests broken by Beancount 2.3.6 #213

Closed ankurdave closed 10 months ago

ankurdave commented 11 months ago

https://github.com/beancount/beancount/pull/726 (released in Beancount 2.3.6) changed the sort order of posting meta items when converting postings to strings. The meta items were previously printed in sorted order, and now are printed in insertion order. This breaks most beancount-import tests because they determine correctness by comparing transactions' string representations.

This PR introduces SortedEntryPrinter, which wraps Beancount's EntryPrinter and restores the previous behavior. It uses SortedEntryPrinter in the two places where tests rely on sort order. This fixes the tests.

Fixes #212.