test_views.py 文件源码

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

项目:pyconjp-website 作者: pyconjp 项目源码 文件源码
def get_csv(self):
        # Call the URL, get the response, parse it strictly as CSV,
        # and return the list of dictionaries
        rsp = self.client.get(self.url)
        self.assertEqual(200, rsp.status_code)
        dialect = csv.excel()
        dialect.strict = True
        reader = csv.DictReader(StringIO(rsp.content), dialect=dialect)
        result = []
        for item in reader:
            for k, v in item.iteritems():
                item[k] = v.decode('utf-8')
            result.append(item)
        return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号