[dataimport] drop extra indirection through MassiveObjectStore._initialized dict
We already have self.__dict__, no need to add another one for a static
set of keys.
# -*- coding: iso-8859-1 -*-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr## This file is part of CubicWeb.## CubicWeb is free software: you can redistribute it and/or modify it under the# terms of the GNU Lesser General Public License as published by the Free# Software Foundation, either version 2.1 of the License, or (at your option)# any later version.## CubicWeb is distributed in the hope that it will be useful, but WITHOUT# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more# details.## You should have received a copy of the GNU Lesser General Public License along# with CubicWeb. If not, see <http://www.gnu.org/licenses/>."""unit tests for i18n messages generator"""importos,os.pathasospimportsysimportsubprocessfromunittestimportTestCase,mainfromcubicweb.cwconfigimportCubicWebNoAppConfigurationDATADIR=osp.join(osp.abspath(osp.dirname(__file__)),'data')defload_po(fname):"""load a po file and return a set of encountered (msgid, msgctx)"""msgs=set()msgid=msgctxt=Noneforlineinopen(fname):ifline.strip()in('','#'):continueifline.startswith('msgstr'):assertnot(msgid,msgctxt)inmsgsmsgs.add((msgid,msgctxt))msgid=msgctxt=Noneelifline.startswith('msgid'):msgid=line.split(' ',1)[1][1:-1]elifline.startswith('msgctx'):msgctxt=line.split(' ',1)[1][1:-1]elifmsgidisnotNone:msgid+=line[1:-1]elifmsgctxtisnotNone:msgctxt+=line[1:-1]returnmsgsclasscubePotGeneratorTC(TestCase):"""test case for i18n pot file generator"""deftest_i18ncube(self):env=os.environ.copy()env['CW_CUBES_PATH']=osp.join(DATADIR,'cubes')if'PYTHONPATH'inenv:env['PYTHONPATH']+=os.pathsepelse:env['PYTHONPATH']=''env['PYTHONPATH']+=DATADIRcwctl=osp.abspath(osp.join(osp.dirname(__file__),'../../bin/cubicweb-ctl'))withopen(os.devnull,'w')asdevnull:subprocess.check_call([sys.executable,cwctl,'i18ncube','i18ntestcube'],env=env,stdout=devnull)cube=osp.join(DATADIR,'cubes','i18ntestcube')msgs=load_po(osp.join(cube,'i18n','en.po.ref'))newmsgs=load_po(osp.join(cube,'i18n','en.po'))self.assertEqual(msgs,newmsgs)if__name__=='__main__':main()