def test_lgcode(): from pyglottolog.monsterlib._libmonster import lgcode for lgcode_, codes in [ ('', []), ('[abc]', ['abc']), ('abc,NOCODE_Abc', ['abc', 'NOCODE_Abc']), ]: assert_equal(lgcode((None, dict(lgcode=lgcode_))), codes)
def inject_macro_area((typ, fields)): mas = set(lgd[x] for x in lgcode((typ, fields)) if x in lgd and lgd[x]) if mas: fields['macro_area'] = ', '.join(sorted(mas)) return typ, fields
def inject_macro_area(arg): typ, fields = arg mas = set(lgd[x] for x in lgcode((typ, fields)) if x in lgd and lgd[x]) if mas: fields['macro_area'] = ', '.join(sorted(mas)) return typ, fields