本文整理汇总了Python中six.six_next函数的典型用法代码示例。如果您正苦于以下问题:Python six_next函数的具体用法?Python six_next怎么用?Python six_next使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了six_next函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_author_encoding
def test_author_encoding(self):
# pylint: disable-msg=E1101
a1 = six_next(self.r.get_new(url_data={'sort': 'new'})).author
a2 = self.r.get_redditor(text_type(a1))
self.assertEqual(a1, a2)
s1 = six_next(a1.get_submitted())
s2 = six_next(a2.get_submitted())
self.assertEqual(s1, s2)
示例2: test_author_encoding
def test_author_encoding(self):
# pylint: disable-msg=E1101
a1 = six_next(self.r.get_front_page()).author
a2 = self.r.get_redditor(text_type(a1))
self.assertEqual(a1, a2)
s1 = six_next(a1.get_submitted())
s2 = six_next(a2.get_submitted())
self.assertEqual(s1, s2)
示例3: next
def next(self):
# Strip whitespace here if the reader was not able to do it by itself already (only CSV is capable of doing it currently)
if self.manually_strip_whitespaces:
newrow = {}
for k, v in six_next(self.reader).iteritems():
if isinstance(v, basestring):
newrow[k] = v.strip()
else:
newrow[k] = v
return newrow
else:
return six_next(self.reader)
示例4: test_equality
def test_equality(self):
subreddit = self.r.get_subreddit(self.sr)
same_subreddit = self.r.get_subreddit(self.sr)
submission = six_next(subreddit.get_hot())
self.assertTrue(subreddit == same_subreddit)
self.assertFalse(subreddit != same_subreddit)
self.assertFalse(subreddit == submission)
示例5: test_mark_as_read
def test_mark_as_read(self):
oth = Reddit(USER_AGENT)
oth.login('PyApiTestUser3', '1111')
# pylint: disable-msg=E1101
msg = six_next(oth.user.get_unread(limit=1))
msg.mark_as_read()
self.assertTrue(msg not in oth.user.get_unread(limit=5))
示例6: test_short_link
def test_short_link(self):
submission = six_next(self.r.get_new(url_data={'sort': 'new'}))
if self.r.config.is_reddit:
self.assertTrue(submission.id in submission.short_link)
else:
self.assertRaises(errors.ClientException, getattr, submission,
'short_link')
示例7: test_short_link
def test_short_link(self):
submission = six_next(self.r.get_front_page())
if self.r.config.is_reddit:
self.assertTrue(submission.id in submission.short_link)
else:
self.assertRaises(errors.ClientException, getattr, submission,
'short_link')
示例8: test_info_by_self_url_raises_warning
def test_info_by_self_url_raises_warning(self):
url = six_next(self.r.get_new(url_data={'sort': 'new'})).permalink
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always')
self.r.info(url)
self.assertEqual(len(w), 1)
self.assertEqual(w[0].category, UserWarning)
self.assertTrue('self' in text_type(w[0].message))
示例9: test_add_comment_and_verify
def test_add_comment_and_verify(self):
text = 'Unique comment: %s' % uuid.uuid4()
# pylint: disable-msg=E1101
submission = six_next(self.subreddit.get_new_by_date())
# pylint: enable-msg=E1101
comment = submission.add_comment(text)
self.assertEqual(comment.submission, submission)
self.assertEqual(comment.body, text)
示例10: test_approve
def test_approve(self):
submission = six_next(self.subreddit.get_spam())
if not submission:
self.fail("Could not find a submission to approve.")
submission.approve()
for approved in self.subreddit.get_new_by_date():
if approved.id == submission.id:
break
else:
self.fail("Could not find approved submission.")
示例11: test_info_by_url_also_found_by_id
def test_info_by_url_also_found_by_id(self):
if self.r.config.is_reddit:
url = 'http://imgur.com/Vr8ZZ'
else:
url = 'http://google.com/?q=82.1753988563'
# pylint: disable-msg=E1101
found_link = six_next(self.r.info(url))
found_by_id = self.r.info(thing_id=found_link.content_id)
self.assertTrue(found_by_id)
self.assertTrue(found_link in found_by_id)
示例12: test_remove
def test_remove(self):
submission = six_next(self.subreddit.get_new_by_date())
if not submission:
self.fail('Could not find a submission to remove.')
submission.remove()
for removed in self.subreddit.get_spam():
if removed.id == submission.id:
break
else:
self.fail('Could not find removed submission.')
示例13: test_refresh_submission
def test_refresh_submission(self):
subreddit = self.r.get_subreddit(self.sr)
submission = six_next(subreddit.get_top())
same_submission = self.r.get_submission(submission_id=submission.id)
if submission.likes:
submission.downvote()
else:
submission.upvote()
self.assertEqual(submission.likes, same_submission.likes)
submission.refresh()
self.assertNotEqual(submission.likes, same_submission.likes)
示例14: stringified_row
def stringified_row(self):
"""Ensure row contents are all strings"""
row = six_next(self._iter)
newrow = []
for element in row:
if element.value is not None:
if isinstance(element.value, datetime):
element = str(element.value)
elif element.data_type is openpyxl.cell.Cell.TYPE_NUMERIC:
element = str(element.value)
else:
element = element.value
else:
element = CLEAR_STRING
newrow.append(element)
return newrow
示例15: test_get_hidden
def test_get_hidden(self):
item = six_next(self.r.user.get_hidden())
item.unhide()
self.delay() # The queue needs to be processed
self.assertFalse(item in list(self.r.user.get_hidden()))