test/unittest_predicates.py
changeset 10529 747eded13c68
parent 10476 62251bfdfd79
child 10704 73367a56ee41
equal deleted inserted replaced
10528:992a54e0df41 10529:747eded13c68
    35 
    35 
    36 
    36 
    37 class ImplementsTC(CubicWebTC):
    37 class ImplementsTC(CubicWebTC):
    38     def test_etype_priority(self):
    38     def test_etype_priority(self):
    39         with self.admin_access.web_request() as req:
    39         with self.admin_access.web_request() as req:
    40             f = req.create_entity('File', data_name=u'hop.txt', data=Binary('hop'))
    40             f = req.create_entity('FakeFile', data_name=u'hop.txt', data=Binary('hop'),
       
    41                                   data_format=u'text/plain')
    41             rset = f.as_rset()
    42             rset = f.as_rset()
    42             anyscore = is_instance('Any')(f.__class__, req, rset=rset)
    43             anyscore = is_instance('Any')(f.__class__, req, rset=rset)
    43             idownscore = adaptable('IDownloadable')(f.__class__, req, rset=rset)
    44             idownscore = adaptable('IDownloadable')(f.__class__, req, rset=rset)
    44             self.assertTrue(idownscore > anyscore, (idownscore, anyscore))
    45             self.assertTrue(idownscore > anyscore, (idownscore, anyscore))
    45             filescore = is_instance('File')(f.__class__, req, rset=rset)
    46             filescore = is_instance('FakeFile')(f.__class__, req, rset=rset)
    46             self.assertTrue(filescore > idownscore, (filescore, idownscore))
    47             self.assertTrue(filescore > idownscore, (filescore, idownscore))
    47 
    48 
    48     def test_etype_inheritance_no_yams_inheritance(self):
    49     def test_etype_inheritance_no_yams_inheritance(self):
    49         cls = self.vreg['etypes'].etype_class('Personne')
    50         cls = self.vreg['etypes'].etype_class('Personne')
    50         with self.admin_access.web_request() as req:
    51         with self.admin_access.web_request() as req: