;ò 2°öBc@sÊdZdkZdkZdklZdklZlZeZ dfd„ƒYZ dfd„ƒYZ dfd „ƒYZ d fd „ƒYZ d klZd klZdklZlZeed„ZdS(sy Common utilities (stubs, mixins) for schooltool unit tests. $Id: utils.py,v 1.2 2004/09/17 13:58:26 dreamcatcher Exp $ N(spformat(s normalize_xmlsdiffsEqualsSortedMixincBstZdZd„ZeZRS(sCMixin that adds a helper method for comparing lists ignoring order.cCs@t|ƒ}t|ƒ}|iƒ|iƒ|i||ƒdS(N(slistsasxsbsyssortsselfs assertEquals(sselfsasbsysx((sY/mnt/gmirror/ports/www/zope-calendaring/work/Calendaring-0.3.0/Calendaring/tests/utils.pysassertEqualsSorted7s     (s__name__s __module__s__doc__sassertEqualsSortedsassertEqualSorted(((sY/mnt/gmirror/ports/www/zope-calendaring/work/Calendaring-0.3.0/Calendaring/tests/utils.pysEqualsSortedMixin4s  sNiceDiffsMixincBs tZdZed„ZeZRS(sYMixin that changes assertEquals to show a unified diff of pretty-printed values. cCsM|tjo#dtt|ƒt|ƒƒ}ntii||||ƒdS(Ns ( smsgsNonesdiffspformatsexpectedsresultssunittestsTestCases assertEqualssself(sselfsresultssexpectedsmsg((sY/mnt/gmirror/ports/www/zope-calendaring/work/Calendaring-0.3.0/Calendaring/tests/utils.pys assertEqualsFs #(s__name__s __module__s__doc__sNones assertEqualss assertEqual(((sY/mnt/gmirror/ports/www/zope-calendaring/work/Calendaring-0.3.0/Calendaring/tests/utils.pysNiceDiffsMixinAs  sXMLCompareMixincBstZfd„ZeZRS(NcCsHt|d|ƒ}t|d|ƒ}|i||dt||ƒƒdS(s9Assert that two XML documents are equivalent. If recursively_sort is given, it is a sequence of tags that will have test:sort="recursively" appended to their attribute lists in 'result' text. See the docstring for normalize_xml for more information about this attribute. srecursively_sorts N(s normalize_xmlsresultsrecursively_sortsexpectedsselfs assertEqualssdiff(sselfsresultsexpectedsrecursively_sort((sY/mnt/gmirror/ports/www/zope-calendaring/work/Calendaring-0.3.0/Calendaring/tests/utils.pysassertEqualsXMLPs(s__name__s __module__sassertEqualsXMLsassertEqualXML(((sY/mnt/gmirror/ports/www/zope-calendaring/work/Calendaring-0.3.0/Calendaring/tests/utils.pysXMLCompareMixinNs sQuietLibxml2MixincBs tZdZd„Zd„ZRS(sÂText mixin that disables libxml2 error reporting. Sadly the API of libxml2 does not allow us to restore the error reporting function in tearDown. cCs dk}|id„tƒdS(NcCstS(N(sNone(sctxserror((sY/mnt/gmirror/ports/www/zope-calendaring/work/Calendaring-0.3.0/Calendaring/tests/utils.pyshs(slibxml2sregisterErrorHandlersNone(sselfslibxml2((sY/mnt/gmirror/ports/www/zope-calendaring/work/Calendaring-0.3.0/Calendaring/tests/utils.pys setUpLibxml2fs cCs&dk}d„}|i|tƒdS(NcCstii|ƒdS(N(ssyssstderrswritesmsg(sctxsmsg((sY/mnt/gmirror/ports/www/zope-calendaring/work/Calendaring-0.3.0/Calendaring/tests/utils.pyson_error_callbackos(slibxml2son_error_callbacksregisterErrorHandlersNone(sselfslibxml2son_error_callback((sY/mnt/gmirror/ports/www/zope-calendaring/work/Calendaring-0.3.0/Calendaring/tests/utils.pystearDownLibxml2js  (s__name__s __module__s__doc__s setUpLibxml2stearDownLibxml2(((sY/mnt/gmirror/ports/www/zope-calendaring/work/Calendaring-0.3.0/Calendaring/tests/utils.pysQuietLibxml2Mixin_s  (s getToolByName(sFactoryTypeInformation(sfixActionsForTypesgetTypec CsÒt|dƒ}d||f}t||ƒ}| o|d}ny|i |ƒWnnX|i t i d|d|ƒt ||tƒ}|ot |dd|ƒ|_n| ot|d|ƒndS(Ns portal_typess%s: %ss portal_typesids typeinfo_namesklasssarchetype_name(s getToolByNamesselfs typesToolspackagestypeNames typeinfo_namesgetTypestypeDescs portal_types _delObjectsmanage_addTypeInformationsFactoryTypeInformations meta_typesgetattrsNoneststitlesignore_actionssfixActionsForType( sselfstypeNamespackages portal_typesignore_actionss typeinfo_names typesToolststypeDesc((sY/mnt/gmirror/ports/www/zope-calendaring/work/Calendaring-0.3.0/Calendaring/tests/utils.pys installTypexs$   (s__doc__ssyssunittestspprintspformats"Products.Calendaring.tests.helperss normalize_xmlsdiffstypes __metaclass__sEqualsSortedMixinsNiceDiffsMixinsXMLCompareMixinsQuietLibxml2MixinsProducts.CMFCore.utilss getToolByNames!Products.Archetypes.ArchetypeToolsFactoryTypeInformationsfixActionsForTypesgetTypesNonesFalses installType(sQuietLibxml2Mixins __metaclass__sEqualsSortedMixinsFactoryTypeInformationsunittestsgetTypes installTypesfixActionsForTypessyss normalize_xmlsXMLCompareMixinspformats getToolByNamesdiffsNiceDiffsMixin((sY/mnt/gmirror/ports/www/zope-calendaring/work/Calendaring-0.3.0/Calendaring/tests/utils.pys?*s