コード例 #1
0
ファイル: test_adapters.py プロジェクト: ed-aicradle/monotone
on this file, this file does not by itself cause the resulting         
work to be covered by the GNU General Public License. However         
the source code for this file must still be made available in         
accordance with section (3) of the GNU General Public License.         
    
This exception does not invalidate any other reasons why a work         
based on this file might be covered by the GNU General Public         
License.
"""
from mpx.componentry.tests import verify_class
from mpx.componentry import implements
from mpx.componentry import Interface
from mpx.lib.uuid.interfaces import IUniquelyIdentified
from mpx.lib.uuid.adapters import UniquelyIdentified

assert verify_class(IUniquelyIdentified,
                    UniquelyIdentified), ('fails interface verify')


class Test(object):
    implements(Interface)


t1 = Test()
t2 = Test()
adapted1 = IUniquelyIdentified(t1)
adapted2 = IUniquelyIdentified(t2)

id1 = adapted1.identifier
id2 = adapted2.identifier

assert id1 != id2, 'Have same ID!'
コード例 #2
0
based on this file might be covered by the GNU General Public         
License.
"""
from mpx.componentry.tests import verify_class
from mpx.www.w3c.xhtml.web_objects import DocumentElement
from mpx.www.w3c.xhtml.web_objects import ContainerElement
from mpx.www.w3c.xhtml.web_objects import SimpleElement
from mpx.www.w3c.xhtml.web_objects import BoundTemplateElement
from mpx.www.w3c.xhtml.web_objects import AttributeDictionary
from mpx.www.w3c.xhtml.interfaces import IDocumentElement
from mpx.www.w3c.xhtml.interfaces import IContainerElement
from mpx.www.w3c.xhtml.interfaces import ISimpleElement
from mpx.www.w3c.xhtml.interfaces import IWebContent

assert verify_class(
    IDocumentElement,
    DocumentElement), ('DocumentElement fails interface verify')

assert verify_class(
    IContainerElement,
    ContainerElement), ('ContainerElement fails interface verify')

assert verify_class(ISimpleElement,
                    SimpleElement), ('SimpleElement fails interface verify')

assert verify_class(
    IWebContent,
    BoundTemplateElement), ('BoundTemplateElement fails interface verify')

assert verify_class(
    IWebContent,
コード例 #3
0
ファイル: test_web_objects.py プロジェクト: mcruse/monotone
This exception does not invalidate any other reasons why a work         
based on this file might be covered by the GNU General Public         
License.
"""
from mpx.componentry.tests import verify_class
from mpx.www.w3c.xhtml.web_objects import DocumentElement
from mpx.www.w3c.xhtml.web_objects import ContainerElement
from mpx.www.w3c.xhtml.web_objects import SimpleElement
from mpx.www.w3c.xhtml.web_objects import BoundTemplateElement
from mpx.www.w3c.xhtml.web_objects import AttributeDictionary
from mpx.www.w3c.xhtml.interfaces import IDocumentElement
from mpx.www.w3c.xhtml.interfaces import IContainerElement
from mpx.www.w3c.xhtml.interfaces import ISimpleElement
from mpx.www.w3c.xhtml.interfaces import IWebContent

assert verify_class(IDocumentElement, DocumentElement), (
    'DocumentElement fails interface verify')

assert verify_class(IContainerElement, ContainerElement), (
    'ContainerElement fails interface verify')

assert verify_class(ISimpleElement, SimpleElement), (
    'SimpleElement fails interface verify')

assert verify_class(IWebContent, BoundTemplateElement), (
    'BoundTemplateElement fails interface verify')

assert verify_class(IWebContent, AttributeDictionary), (
    'AttributeDictionary fails interface verify')

コード例 #4
0
ファイル: test_node.py プロジェクト: ed-aicradle/monotone
from mpx.lib.neode.interfaces import IEnableAble
from mpx.lib.neode.interfaces import IRunnable
from mpx.lib.neode.interfaces import INodeSpace
from mpx.lib.neode.interfaces import IConfigurableNode
from mpx.lib.neode.interfaces import ICompositeNode
from mpx.lib.neode.interfaces import IDeferredNode
from mpx.lib.neode.interfaces import IService
from mpx.lib.neode.interfaces import IRootNode
from mpx.lib.neode.interfaces import IAlias
from mpx.lib.neode.interfaces import IAliases
from mpx.lib.neode.node import NodeSpace
from mpx.lib.neode.node import ConfigurableNode
from mpx.lib.neode.node import CompositeNode
from mpx.lib.neode.node import RootNode

assert verify_class(INode, ConfigurableNode), 'fails interface verify'
assert verify_class(IChildNode, ConfigurableNode), 'fails interface verify'
assert verify_class(IInspectable, ConfigurableNode), 'fails interface verify'
assert verify_class(IModifiable, ConfigurableNode), 'fails interface verify'
assert verify_class(IConfigurable, ConfigurableNode), 'fails interface verify'
assert verify_class(IEnableAble, ConfigurableNode), 'fails interface verify'
assert verify_class(IRunnable, ConfigurableNode), 'fails interface verify'
assert verify_class(IConfigurableNode,
                    ConfigurableNode), 'fails interface verify'

assert verify_class(INode, CompositeNode), 'fails interface verify'
assert verify_class(IChildNode, CompositeNode), 'fails interface verify'
assert verify_class(IParentNode, CompositeNode), 'fails interface verify'
assert verify_class(IInspectable, CompositeNode), 'fails interface verify'
assert verify_class(IModifiable, CompositeNode), 'fails interface verify'
assert verify_class(IConfigurable, CompositeNode), 'fails interface verify'
コード例 #5
0
ファイル: test_adapters.py プロジェクト: ed-aicradle/monotone
on this file, this file does not by itself cause the resulting         
work to be covered by the GNU General Public License. However         
the source code for this file must still be made available in         
accordance with section (3) of the GNU General Public License.         
    
This exception does not invalidate any other reasons why a work         
based on this file might be covered by the GNU General Public         
License.
"""
from mpx.componentry import implements
from mpx.componentry import Interface
from mpx.componentry.tests import verify_class
from mpx.lib.metadata.interfaces import IMetaDataProvider
from mpx.lib.metadata.adapters import MetaDataProvider

assert verify_class(IMetaDataProvider,
                    MetaDataProvider), ('fails interface verify')


class C(object):
    implements(Interface)

    def __init__(self,
                 name='test',
                 value='test value',
                 nstest='Namespace conflict test'):
        self.name = name
        self.value = value
        self.__predicate = nstest


objects = []
コード例 #6
0
ファイル: test_adapters.py プロジェクト: ed-aicradle/monotone
work to be covered by the GNU General Public License. However         
the source code for this file must still be made available in         
accordance with section (3) of the GNU General Public License.         
    
This exception does not invalidate any other reasons why a work         
based on this file might be covered by the GNU General Public         
License.
"""
from mpx.componentry.tests import verify_class
from mpx.www.w3c.syndication.rss1.interfaces import IRSS1Content
from mpx.www.w3c.syndication.rss2.interfaces import IRSS2Content
from mpx.www.w3c.syndication.atom.interfaces import IAtomContent
from mpx.service.alarms2.presentation.syndication.atom.adapters import AtomSyndicator
from mpx.service.alarms2.presentation.syndication.rss2.adapters import RSS2Syndicator

assert verify_class(IRSS2Content, RSS2Syndicator), (
    'fails interface verify')

assert verify_class(IAtomContent, AtomSyndicator), (
    'fails interface verify')

from mpx.service.alarms2.tests.test_alarm import alarm_manager






rss2 = IRSS2Content(alarm_manager)
rssout = open('/var/www/sgreen/dev/output/rss2test.rss', 'w')
rssout.write(rss2.render())
コード例 #7
0
ファイル: test_adapters.py プロジェクト: mcruse/monotone
on this file, this file does not by itself cause the resulting         
work to be covered by the GNU General Public License. However         
the source code for this file must still be made available in         
accordance with section (3) of the GNU General Public License.         
    
This exception does not invalidate any other reasons why a work         
based on this file might be covered by the GNU General Public         
License.
"""
from mpx.componentry.tests import verify_class
from mpx.componentry import implements
from mpx.componentry import Interface
from mpx.lib.uuid.interfaces import IUniquelyIdentified
from mpx.lib.uuid.adapters import UniquelyIdentified

assert verify_class(IUniquelyIdentified, UniquelyIdentified), (
    'fails interface verify')

class Test(object):
    implements(Interface)

t1 = Test()
t2 = Test()
adapted1 = IUniquelyIdentified(t1)
adapted2 = IUniquelyIdentified(t2)

id1 = adapted1.identifier
id2 = adapted2.identifier

assert id1 != id2, 'Have same ID!'
assert id1 == adapted1.identifier, 'ID changed!'