Issue #146: bean-format fails on currencies that contain "_" (underscore) (blais/beancount)

9 views
Skip to first unread message

Stefano Zacchiroli

unread,
Nov 9, 2016, 11:09:30 AM11/9/16
to bean...@googlegroups.com
New issue 146: bean-format fails on currencies that contain "_" (underscore)
https://bitbucket.org/blais/beancount/issues/146/bean-format-fails-on-currencies-that

Stefano Zacchiroli:

The following beancount input:
```
#!beancount

1970-01-01 open Equity:Opening-balances
1970-01-01 open Assets:Investments

2014-03-31 * "opening"
Assets:Investments 1.23 FOO_BAR
Equity:Opening-balances
```
passes bean-check just fine, but makes bean-format fail with an assertion error:
```
#!

Traceback (most recent call last):
File "/home/zack/.local/bin/bean-format", line 2, in <module>
from beancount.scripts.format import main; main()
File "/home/zack/.local/lib/python3.5/site-packages/beancount/scripts/format.py", line 154, in main
formatted_contents = align_beancount(contents)
File "/home/zack/.local/lib/python3.5/site-packages/beancount/scripts/format.py", line 81, in align_beancount
assert (old_stripped == new_stripped), (old_stripped, new_stripped)
AssertionError: ('1970-01-01 open Equity:Opening-balances 1970-01-01 open Assets:Investments 2014-03-31 * "opening" Assets:Investments 1.23 FOO_BAR Equity:Opening-balances', '1970-01-01 open Equity:Opening-balances 1970-01-01 open Assets:Investments 2014-03-31 * "opening" Assets:Investments Equity:Opening-balances')
```
By the look of it, it's possible that just an "_" is missing in the final part of the regex in python/beancount/scripts/format.py:align_beancount(). But I haven't tested the fix yet.


Reply all
Reply to author
Forward
0 new messages