예제 #1
0
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)
예제 #2
0
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)
예제 #3
0
 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
예제 #4
0
파일: monster.py 프로젝트: clld/glottolog
 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