test_interface.py 文件源码

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

项目:zenchmarks 作者: squeaky-pl 项目源码 文件源码
def test_namesAndDescriptions_w_all_True_simple(self):
        from zope.interface.interface import Attribute
        from zope.interface.interface import fromFunction
        def _bar():
            """DOCSTRING"""
        BASE_ATTRS = {'foo': Attribute('Foo', ''),
                      'bar': fromFunction(_bar),
                     }
        DERIVED_ATTRS = {'baz': Attribute('Baz', ''),
                        }
        base = self._makeOne('IBase', attrs=BASE_ATTRS)
        derived = self._makeOne('IDerived', bases=(base,), attrs=DERIVED_ATTRS)
        self.assertEqual(sorted(derived.namesAndDescriptions(all=True)),
                        [('bar', BASE_ATTRS['bar']),
                         ('baz', DERIVED_ATTRS['baz']),
                         ('foo', BASE_ATTRS['foo']),
                        ])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号