--- a/test/data/entities.py Fri Apr 24 15:37:51 2009 +0200
+++ b/test/data/entities.py Fri Apr 24 15:38:11 2009 +0200
@@ -1,15 +1,15 @@
from cubicweb.entities import AnyEntity, fetch_config
-class Personne(AnyEntity):
+class Societe(AnyEntity):
+ id = 'Societe'
+ fetch_attrs = ('nom',)
+
+class Personne(Societe):
"""customized class forne Person entities"""
id = 'Personne'
fetch_attrs, fetch_order = fetch_config(['nom', 'prenom'])
rest_attr = 'nom'
-class Societe(AnyEntity):
- id = 'Societe'
- fetch_attrs = ('nom',)
-
class Note(AnyEntity):
id = 'Note'
--- a/test/unittest_selectors.py Fri Apr 24 15:37:51 2009 +0200
+++ b/test/unittest_selectors.py Fri Apr 24 15:38:11 2009 +0200
@@ -7,9 +7,9 @@
from logilab.common.testlib import TestCase, unittest_main
+from cubicweb.devtools.testlib import EnvBasedTC
from cubicweb.vregistry import Selector, AndSelector, OrSelector
from cubicweb.selectors import implements
-
from cubicweb.interfaces import IDownloadable
class _1_(Selector):
@@ -48,7 +48,7 @@
self.assertEquals(selector(None), 3)
selector = _2_ & _1_()
self.assertEquals(selector(None), 3)
-
+
def test_three_and(self):
selector = _1_() & _1_() & _1_()
self.assertEquals(selector(None), 3)
@@ -84,8 +84,7 @@
self.assertIs(csel.search_selector(implements), sel)
csel = AndSelector(Selector(), sel)
self.assertIs(csel.search_selector(implements), sel)
-
-from cubicweb.devtools.testlib import EnvBasedTC
+
class ImplementsSelectorTC(EnvBasedTC):
def test_etype_priority(self):
@@ -96,7 +95,11 @@
self.failUnless(idownscore > anyscore, (idownscore, anyscore))
filescore = implements('File').score_class(cls, req)
self.failUnless(filescore > idownscore, (filescore, idownscore))
-
+
+ def test_etype_inheritance_no_yams_inheritance(self):
+ cls = self.vreg.etype_class('Personne')
+ self.failIf(implements('Societe').score_class(cls, self.request()))
+
if __name__ == '__main__':
unittest_main()