test_csv.py 文件源码

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

项目:oil 作者: oilshell 项目源码 文件源码
def test_write_arg_valid(self):
        self._write_error_test(csv.Error, None)
        self._write_test((), '')
        self._write_test([None], '""')
        self._write_error_test(csv.Error, [None], quoting = csv.QUOTE_NONE)
        # Check that exceptions are passed up the chain
        class BadList:
            def __len__(self):
                return 10;
            def __getitem__(self, i):
                if i > 2:
                    raise IOError
        self._write_error_test(IOError, BadList())
        class BadItem:
            def __str__(self):
                raise IOError
        self._write_error_test(IOError, [BadItem()])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号