def test_cache(caching_api, api): lang = api.languoid('abcd1234') assert lang is not api.languoid('abcd1234') lang = caching_api.languoid('abcd1234') assert lang is caching_api.languoid('abcd1234') assert caching_api.languoid('aaa') is lang l2 = caching_api.languoid('abc') assert l2.id == 'abcd1235' assert l2.ancestors
def test_descendants_from_nodemap(api): nodemap = {n.id: n for n in api.languoids()} l = api.languoid('abcd1234') assert len(l.descendants_from_nodemap(nodemap)) == 2 assert len(l.descendants_from_nodemap(nodemap, level=api.languoid_levels.language)) == 1 assert len(l.descendants_from_nodemap(nodemap, level='dialect')) == 1 with pytest.raises(ValueError): l.descendants_from_nodemap(nodemap, level='dialects')
def test_descendants_from_nodemap(api): nodemap = {n.id: n for n in api.languoids()} l = api.languoid('abcd1234') assert len(l.descendants_from_nodemap(nodemap)) == 2 assert len( l.descendants_from_nodemap(nodemap, level=api.languoid_levels.language)) == 1 assert len( l.descendants_from_nodemap(nodemap, level=api.languoid_levels.dialect)) == 1
def test_languoid(api): assert api.languoid('abc').name == 'language'