twitter_test.py 文件源码

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

项目:gif-disco 作者: futurice 项目源码 文件源码
def testTwitterError(self):
    '''Test that twitter responses containing an error message are wrapped.'''
    self._AddHandler('https://api.twitter.com/1.1/statuses/user_timeline.json',
                     curry(self._OpenTestData, 'public_timeline_error.json'))
    # Manually try/catch so we can check the exception's value
    try:
      statuses = self._api.GetUserTimeline()
    except twitter.TwitterError, error:
      # If the error message matches, the test passes
      self.assertEqual('test error', error.message)
    else:
      self.fail('TwitterError expected')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号