Changeset - 328f59231c08
[Not reviewed]
0 2 0
Brett Smith - 3 years ago 2021-02-11 16:17:24
brettcsmith@brettcsmith.org
meta_tax_implication: Accept titlecased values.
2 files changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/plugin/meta_tax_implication.py
Show inline comments
...
 
@@ -23,12 +23,15 @@ from ..beancount_types import (
 
def _make_aliases(s: str, stdname: Optional[str]=None) -> Iterator[Tuple[str, str]]:
 
    if stdname is None:
 
        stdname = s
 
    elif s != stdname:
 
        yield (s, stdname)
 
    yield (s.lower(), stdname)
 
    title_s = s.title()
 
    if s != title_s:
 
        yield (title_s, stdname)
 
    if s.startswith('1099-'):
 
        yield from _make_aliases(f'1099{s[5:]}', stdname)
 
    elif s.startswith('USA-'):
 
        yield from _make_aliases(f'US-{s[4:]}', stdname)
 
    if s.endswith('-Corporation'):
 
        yield from _make_aliases(f'{s[:-12]}-Corp', stdname)
tests/test_meta_tax_implication.py
Show inline comments
...
 
@@ -12,13 +12,13 @@ from . import testutil
 
from conservancy_beancount.plugin import meta_tax_implication
 

	
 
VALID_VALUES = {
 
    '1099': '1099-NEC',
 
    '1099-NEC': '1099-NEC',
 
    '1099nec': '1099-NEC',
 
    '1099-MISC-Other': '1099-MISC-Other',
 
    '1099-Misc-Other': '1099-MISC-Other',
 
    '1099misc-other': '1099-MISC-Other',
 
    'Bank-Transfer': 'Bank-Transfer',
 
    'Chargeback': 'Chargeback',
 
    'Foreign-Corporation': 'Foreign-Corporation',
 
    'foreign-corp': 'Foreign-Corporation',
 
    'Foreign-Grantee': 'Foreign-Grantee',
0 comments (0 inline, 0 general)