def test_morfeusz(): try: import morfeusz print(morfeusz.about()) except ImportError: print('Missing morfeusz library, please run:') print('pip install python-morfeusz') print('or') print('pip install -r requirements.txt') except OSError: print('Probably missing: libmorfeusz.so.0, or cannot load') if p.exists('libmorfeusz.so.0'): print('The file is there. You need library path:') print('$ source so_path.source_me.sh') print('Current path:', os.environ.get('LD_LIBRARY_PATH', '(not set)')) else: print('morfeusz module loaded succesfully.')
def test_type(self): self.assertEqual( type(morfeusz.about()), type(u('')) )
if py3k: import unittest else: import unittest2 as unittest import morfeusz if py3k: def u(s): return s else: def u(s): return s.decode('UTF-8') sgjp = 'SGJP' in morfeusz.about() class test_expand_tags(unittest.TestCase): def test1(self): tags = 'adj:sg:nom:m1.m2.m3:pos|adj:sg:acc:m3:pos' xtags = morfeusz.expand_tags(tags) self.assertEqual(list(xtags), [ 'adj:sg:nom:m1:pos', 'adj:sg:nom:m2:pos', 'adj:sg:nom:m3:pos', 'adj:sg:acc:m3:pos', ]) def test2(self): tags = 'adj:sg:nom:m1.m2.m3:pos|adj:sg:acc:m3:pos'