[js] Remove tab mixed with space in ``web/data/cubicweb.facets.js``
from__future__importwith_statementimportsocketfromdatetimeimportdatetimefromlogilab.common.testlibimportSkipTestfromcubicweb.devtoolsimportApptestConfigurationfromcubicweb.devtools.testlibimportCubicWebTCfromcubicweb.selectorsimportis_instancefromcubicweb.entities.adaptersimportIFTIndexableAdapterAT_LOGILAB=socket.gethostname().endswith('.logilab.fr')# XXXfromunittest_querierimportFixedOffsetclassPostgresFTITC(CubicWebTC):@classmethoddefsetUpClass(cls):ifnotAT_LOGILAB:# XXX here until we can raise SkipTest in setUp to detect we can't connect to the dbraiseSkipTest('XXX %s: require logilab configuration'%cls.__name__)cls.config=ApptestConfiguration('data',sourcefile='sources_postgres',apphome=cls.datadir)deftest_occurence_count(self):req=self.request()c1=req.create_entity('Card',title=u'c1',content=u'cubicweb cubicweb cubicweb')c2=req.create_entity('Card',title=u'c3',content=u'cubicweb')c3=req.create_entity('Card',title=u'c2',content=u'cubicweb cubicweb')self.commit()self.assertEqual(req.execute('Card X ORDERBY FTIRANK(X) DESC WHERE X has_text "cubicweb"').rows,[[c1.eid],[c3.eid],[c2.eid]])deftest_attr_weight(self):classCardIFTIndexableAdapter(IFTIndexableAdapter):__select__=is_instance('Card')attr_weight={'title':'A'}withself.temporary_appobjects(CardIFTIndexableAdapter):req=self.request()c1=req.create_entity('Card',title=u'c1',content=u'cubicweb cubicweb cubicweb')c2=req.create_entity('Card',title=u'c2',content=u'cubicweb cubicweb')c3=req.create_entity('Card',title=u'cubicweb',content=u'autre chose')self.commit()self.assertEqual(req.execute('Card X ORDERBY FTIRANK(X) DESC WHERE X has_text "cubicweb"').rows,[[c3.eid],[c1.eid],[c2.eid]])deftest_entity_weight(self):classPersonneIFTIndexableAdapter(IFTIndexableAdapter):__select__=is_instance('Personne')entity_weight=2.0withself.temporary_appobjects(PersonneIFTIndexableAdapter):req=self.request()c1=req.create_entity('Personne',nom=u'c1',prenom=u'cubicweb')c2=req.create_entity('Comment',content=u'cubicweb cubicweb',comments=c1)c3=req.create_entity('Comment',content=u'cubicweb cubicweb cubicweb',comments=c1)self.commit()self.assertEqual(req.execute('Any X ORDERBY FTIRANK(X) DESC WHERE X has_text "cubicweb"').rows,[[c1.eid],[c3.eid],[c2.eid]])deftest_tz_datetime(self):self.execute("INSERT Personne X: X nom 'bob', X tzdatenaiss %(date)s",{'date':datetime(1977,6,7,2,0,tzinfo=FixedOffset(1))})datenaiss=self.execute("Any XD WHERE X nom 'bob', X tzdatenaiss XD")[0][0]self.assertEqual(datenaiss.tzinfo,None)self.assertEqual(datenaiss.utctimetuple()[:5],(1977,6,7,1,0))self.commit()self.execute("INSERT Personne X: X nom 'boby', X tzdatenaiss %(date)s",{'date':datetime(1977,6,7,2,0)})datenaiss=self.execute("Any XD WHERE X nom 'boby', X tzdatenaiss XD")[0][0]self.assertEqual(datenaiss.tzinfo,None)self.assertEqual(datenaiss.utctimetuple()[:5],(1977,6,7,2,0))if__name__=='__main__':fromlogilab.common.testlibimportunittest_mainunittest_main()