Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(14)  |  Call(12)  |  Derive(0)  |  Import(2)

src/p/r/Products.Archetypes-1.10.1/Products/Archetypes/tests/test_traverse.py   Products.Archetypes(Download)
from zope.interface.verify import verifyClass
from zope.publisher.interfaces import IPublishTraverse
from Products.Archetypes.traverse import ImageTraverser
from Products.Archetypes.atapi import ImageField
 
    def testUnknownField(self):
        traverser = ImageTraverser(MockContext(), None)
        self.assertTrue(traverser.publishTraverse(None, "missing") is fallback_marker)
 
    def testWrongFieldType(self):
        context = MockContext()
        context.field = BaseMockField("Other.Type")
        traverser = ImageTraverser(context, None)
    def testCorrectFieldType(self):
        context = MockContext()
        context.field = MockField("Other.Type")
        traverser = ImageTraverser(context, None)
        self.assertTrue(traverser.publishTraverse(None, "field") is data_marker)
 
    def testFullImage(self):
        context = MockContext()
        context.field = MockField("Products.Archetypes.Field.ImageField")
        traverser = ImageTraverser(context, None)

src/p/r/Products.Archetypes-HEAD/Products/Archetypes/tests/test_traverse.py   Products.Archetypes(Download)
from zope.interface.verify import verifyClass
from zope.publisher.interfaces import IPublishTraverse
from Products.Archetypes.traverse import ImageTraverser
from Products.Archetypes.atapi import ImageField
 
    def testUnknownField(self):
        traverser = ImageTraverser(MockContext(), None)
        self.assertTrue(traverser.publishTraverse(None, "missing") is fallback_marker)
 
    def testWrongFieldType(self):
        context = MockContext()
        context.field = BaseMockField("Other.Type")
        traverser = ImageTraverser(context, None)
    def testCorrectFieldType(self):
        context = MockContext()
        context.field = MockField("Other.Type")
        traverser = ImageTraverser(context, None)
        self.assertTrue(traverser.publishTraverse(None, "field") is data_marker)
 
    def testFullImage(self):
        context = MockContext()
        context.field = MockField("Products.Archetypes.Field.ImageField")
        traverser = ImageTraverser(context, None)