def __init__(self, e): Quad.SchemaInstance.__init__(self, Quad, s=sctId(e[1]), a=sctId(e[2]), t=target(t_sctid=sctId(e[3])), g=groupId(e[4])) self.id = e[0]
def test_1(self): Quad = Schema( lambda q: q.a != is_a or (q.g == 0 and q.t.inran("t_sctid")), s=sctId, a=sctId, t=target, g=groupId ) v = sctId(450828004) t = target(t_sctid=v) q1 = Quad(s=sctId(450828004), a=sctId(116680003), t=t, g=zero_group) with self.assertRaises(AssertionError): Quad(s=sctId(450828004), a=sctId(116680003), t=target(t_sctid=sctId(450828004)), g=groupId(1)) with self.assertRaises(AssertionError): Quad(s=sctId(450828004), a=sctId(116680003), t=target(t_sctid=sctId(450828004)), g=groupId(1), l=1) self.assertTrue(q1.__eq__(q1)) self.assertEqual(q1, q1) self.assertEqual( Quad(s=sctId(450828004), a=sctId(116680003), t=target(t_sctid=sctId(450828004)), g=zero_group), q1 ) self.assertNotEqual( Quad(s=sctId(450829007), a=sctId(116680003), t=target(t_sctid=sctId(450828004)), g=zero_group), q1 ) self.assertNotEqual(1, q1) foo = Schema(v=int) self.assertNotEqual(foo(v=1), q1)