unittest_entity ok tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 18 Feb 2009 01:32:07 +0100
branchtls-sprint
changeset 748 eec752381926
parent 747 af9c15653ea9
child 749 c23169f79a3b
unittest_entity ok
test/data/schema.py
test/unittest_entity.py
--- a/test/data/schema.py	Wed Feb 18 01:25:51 2009 +0100
+++ b/test/data/schema.py	Wed Feb 18 01:32:07 2009 +0100
@@ -1,5 +1,5 @@
 class Personne(EntityType):
-    nom = String()
+    nom = String(required=True)
     prenom = String()
     type = String()
     travaille = SubjectRelation('Societe')
--- a/test/unittest_entity.py	Wed Feb 18 01:25:51 2009 +0100
+++ b/test/unittest_entity.py	Wed Feb 18 01:32:07 2009 +0100
@@ -20,9 +20,9 @@
         self.failUnless(e)
 
     def test_yams_inheritance(self):
-        from entities import AnotherNote
+        from entities import Note
         e = self.etype_instance('SubNote')
-        self.assertIsInstance(e, AnotherNote)
+        self.assertIsInstance(e, Note)
         e2 = self.etype_instance('SubNote')
         self.assertIs(e.__class__, e2.__class__)
 
@@ -266,31 +266,17 @@
                                ('owned_by', 'object'),
                                ('bookmarked_by', 'object')])
         e = self.etype_instance('Personne')
-        print rbc(e.relations_by_category('primary'))
         self.assertListEquals(rbc(e.relations_by_category('primary')),
                               [('nom', 'subject'), ('eid', 'subject')])
         self.assertListEquals(rbc(e.relations_by_category('secondary')),
                               [('prenom', 'subject'),
-                               ('sexe', 'subject'),
-                               ('promo', 'subject'),
-                               ('titre', 'subject'),
-                               ('adel', 'subject'),
-                               ('ass', 'subject'),
-                               ('web', 'subject'),
-                               ('tel', 'subject'),
-                               ('fax', 'subject'),
-                               ('datenaiss', 'subject'),
-                               ('test', 'subject'),
-                               ('description', 'subject'),
-                               ('salary', 'subject')])
+                               ('type', 'subject'),])
         self.assertListEquals(rbc(e.relations_by_category('generic')),
-                              [('concerne', 'subject'),
+                              [('travaille', 'subject'),
+                               ('evaluee', 'subject'),
                                ('connait', 'subject'),
-                               ('evaluee', 'subject'),
-                               ('travaille', 'subject'),
                                ('ecrit_par', 'object'),
                                ('evaluee', 'object'),
-                               ('liee_a', 'object'),
                                ('tags', 'object')])
         self.assertListEquals(rbc(e.relations_by_category('generated')),
                               [('created_by', 'subject'),