test_static.py 文件源码

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

项目:zenchmarks 作者: squeaky-pl 项目源码 文件源码
def test_ignoredExtensionsIgnored(self):
        """
        A request for the I{base} child of a L{File} succeeds with a resource
        for the I{base<extension>} file in the path the L{File} was created
        with if such a file exists and the L{File} has been configured to
        ignore the I{<extension>} extension.
        """
        base = FilePath(self.mktemp())
        base.makedirs()
        base.child('foo.bar').setContent(b'baz')
        base.child('foo.quux').setContent(b'foobar')
        file = static.File(base.path, ignoredExts=(b".bar",))

        request = DummyRequest([b"foo"])
        child = resource.getChildForRequest(file, request)

        d = self._render(child, request)
        def cbRendered(ignored):
            self.assertEqual(b''.join(request.written), b'baz')
        d.addCallback(cbRendered)
        return d
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号