示例#1
0
文件: __init__.py 项目: jimmydo/grain
    def test_overrides_base_method(self):
        items = []

        class Extension(object):
            @staticmethod
            def fail():
                items.append('fail')

        expecter = expect.extend(Extension)
        expecter.fail()
        assert items == ['fail']
示例#2
0
文件: __init__.py 项目: jimmydo/grain
    def test_right_most_extension_takes_precedence(self):
        items = []

        class Extension(object):
            def some_method(self):
                items.append('method')

            @classmethod
            def some_classmethod(cls):
                items.append('classmethod')

        expecter = expect.extend(self.extension, Extension)
        expecter(None).some_method()
        expecter.some_classmethod()
        assert items == ['method', 'classmethod']