# HG changeset patch # User Sylvain Thénault <sylvain.thenault@logilab.fr> # Date 1249630125 -7200 # Fri Aug 07 09:28:45 2009 +0200 # Node ID c10af0aeff199659fb6517c694269185dd78d259 # Parent 4231935543c770448c697bfd10cfd84375015b01 add non regression test diff --git a/test/unittest_analyze.py b/test/unittest_analyze.py --- a/test/unittest_analyze.py +++ b/test/unittest_analyze.py @@ -110,12 +110,14 @@ ('Student', ('Eetype',) ), ('Company', ('Eetype',) ), ('Address', ('Eetype',) ), + ('Eetype', ('Eetype',) ), ) ), 'is_instance_of' : RelationSchema( ( ('Person', ('Eetype',) ), ('Student', ('Eetype',) ), ('Company', ('Eetype',) ), ('Address', ('Eetype',) ), + ('Eetype', ('Eetype',) ), ) ), 'connait' : RelationSchema( (('Person', ('Person',) ), @@ -309,6 +311,22 @@ sols = sorted(node.children[0].solutions) self.assertEquals(sols, [{'X': 'Company'}]) + def test_non_regr_subjobj(self): + h = self.helper + def type_from_uid(name): + self.assertEquals(name, "Societe") + return 'Eetype' + uid_func_mapping = {'name': type_from_uid} + # constant as rhs of the uid relation + node = h.parse('Any X WHERE X name "Societe", X is ISOBJ, ISSIBJ is X') + h.compute_solutions(node, uid_func_mapping, debug=DEBUG) + sols = sorted(node.children[0].solutions) + self.assertEquals(sols, [{'X': 'Eetype', 'ISOBJ': 'Eetype', 'ISSIBJ': 'Address'}, + {'X': 'Eetype', 'ISOBJ': 'Eetype', 'ISSIBJ': 'Company'}, + {'X': 'Eetype', 'ISOBJ': 'Eetype', 'ISSIBJ': 'Eetype'}, + {'X': 'Eetype', 'ISOBJ': 'Eetype', 'ISSIBJ': 'Person'}, + {'X': 'Eetype', 'ISOBJ': 'Eetype', 'ISSIBJ': 'Student'}]) + def test_unusableuid_func_mapping(self): h = self.helper