test__field.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:guillotina 作者: plone 项目源码 文件源码
def test_bind_w_voc_is_ICSB(self):
        from zope.interface import implementer
        from guillotina.schema.interfaces import IContextSourceBinder
        from guillotina.schema.interfaces import ISource

        @implementer(IContextSourceBinder)
        @implementer(ISource)
        class Vocab(object):
            def __init__(self, context):
                self.context = context

            def __call__(self, context):
                return self.__class__(context)

        # Chicken-egg
        source = self._makeOne(vocabulary='temp')
        source.vocabulary = Vocab(source)
        source.vocabularyName = None
        instance = DummyInstance()
        target = source.bind(instance)
        self.assertEqual(target.vocabulary.context, instance)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号