Pierre Carbonnelle  committed 5e3fef6

support A.c[z]==Y, where z is an instance of a subclass of A.

  • Participants
  • Parent commits ba989e5
  • Branches default

Comments (0)

Files changed (2)

File pyDatalog/examples/

     assert (Z.c[X]>'a') == [(z,)]
     assert ((Z.c[X]>'a') & (A.c[X]=='za')) == [(z,)]
     assert (A.c[X]=='za') == [(z,)]
+    assert (A.c[z]=='za') == [()]
     assert (z.b) == 'za'
     assert (z.c) == 'za'

File pyDatalog/

             elif isinstance(arg, Literal):
                 raise pyDatalog.DatalogError("Syntax error: Literals cannot have a literal as argument : %s%s" % (predicate_name, terms), None, None)
-            elif i==0 and cls_name and arg.__class__.__name__ != cls_name: # TODO use __mro__ !
+            elif i==0 and cls_name and cls_name not in [c.__name__ for c in arg.__class__.__mro__]:
                 raise TypeError("Object is incompatible with the class that is queried.")
             elif isinstance(arg, Aggregate):
                 raise pyDatalog.DatalogError("Syntax error: Incorrect use of aggregation.", None, None)