tbm / test

0 stars 0 forks source link

bean-format fail on files without transactions #80

Closed tbm closed 9 years ago

tbm commented 9 years ago

Original report by Yuchen Ying (Bitbucket: yegle, GitHub: yegle).


Just started using beancount and there's only "open" statements in the file. It looks like this:

2015-07-16 open Assets:BoA:checking USD

And bean-format will fail on such a file:

Traceback (most recent call last):
  File "/Users/yegle/.py3kvenv/bin/bean-format", line 2, in <module>
    from beancount.scripts.format import main; main()
  File "/Users/yegle/.py3kvenv/lib/python3.5/site-packages/beancount/scripts/format.py", line 150, in main
    formatted_contents = align_beancount(contents)
  File "/Users/yegle/.py3kvenv/lib/python3.5/site-packages/beancount/scripts/format.py", line 49, in align_beancount
    for prefix, number, _ in match_pairs
ValueError: max() arg is an empty sequence
tbm commented 9 years ago

Original comment by Martin Blais (Bitbucket: blais, GitHub: blais).


Fixed Issue #80: Edge case in beancount.scripts.format that would fail when there is nothing to align.