def test_glossary(self): txt = random_usl(Text) self.assertTrue(all(t.script in Dictionary() for t in txt.words)) self.assertTrue(all(t in txt for t in txt.words)) with self.assertRaises(ValueError): 'test' in txt
def test_random(self): r = RandomPoolIEMLObjectGenerator(level=Fact) s = r.fact() p = path("s+a+m + (s+a+m):(r+f)") elems = resolve(s, p) self.assertSetEqual(elems, s.topics.union(s.words)) p = path("t + t:(s+a+m+r+f+(s+a+m):(s+a+m+r+f+(s+a+m):(r+f)))") usl = random_usl(rank_type=Text) elems = resolve(usl, p) self.assertSetEqual( usl.facts.union(usl.topics).union(usl.words).union(usl.theories), elems)
def test_translation(self): u = random_usl(rank_type=Text) t = u.auto_translation() self.assertIn('fr', t) self.assertIn('en', t)
def test_deference_path(self): u = random_usl(rank_type=Text) p = random.sample(tuple(u.paths.items()), 1) self.assertEqual(u[p[0][0]], p[0][1])
def test_random_usl(self): u = random_usl() self.assertIsInstance(u, Usl) u = random_usl(rank_type=Word) self.assertIsInstance(u, Word)