def test_derivable(self): baba = ExampleFrameworks.with_chaining() self.assertTrue(Semantics.derivable(baba, a, [b, d, f])) self.assertTrue(Semantics.derivable(baba, a, [b, d, f, g])) self.assertTrue(Semantics.derivable(baba, g, [c])) self.assertTrue(Semantics.derivable(baba, g, [d, f])) self.assertFalse(Semantics.derivable(baba, g, [d])) self.assertFalse(Semantics.derivable(baba, a, [b, d])) self.assertFalse(Semantics.derivable(baba, a, [b, f, g]))
def test_derivable_set(self): baba = ExampleFrameworks.with_chaining() self.assertTrue( all([ element in Semantics.derivable_set(baba, [b, c]) for element in [a, b, c, g] ])) self.assertEqual(4, len(Semantics.derivable_set(baba, [b, c]))) self.assertTrue( all([ element in Semantics.derivable_set(baba, [b, d, f]) for element in [a, b, c, d, e, f, g] ])) self.assertEqual(7, len(Semantics.derivable_set(baba, [b, d, f]))) self.assertTrue( all([ element in Semantics.derivable_set(baba, [a, d]) for element in [a, d] ])) self.assertEqual(2, len(Semantics.derivable_set(baba, [a, d])))