当前位置: 首页>>代码示例>>Python>>正文


Python tests.create_status函数代码示例

本文整理汇总了Python中tests.create_status函数的典型用法代码示例。如果您正苦于以下问题:Python create_status函数的具体用法?Python create_status怎么用?Python create_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了create_status函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_insert_different_statuses

    def test_insert_different_statuses(self):
        old_status = create_status(created_at=datetime(1988, 12, 19))
        new_status = create_status(id=2)

        self.timeline.add_statuses([old_status, new_status])

        self.assertEqual(len(self.timeline), 2)
开发者ID:battlemidget,项目名称:turses,代码行数:7,代码来源:test_models.py

示例2: test_map_attributes_to_retweet_with_hashtag

    def test_map_attributes_to_retweet_with_hashtag(self):
        original_author = 'dialelo'
        original_text = 'I <3 #Python'
        original_status = create_status(user=original_author,
                                        text=original_text)

        text = 'RT @%s: %s' % (original_author, original_text)
        entities = {
            u'user_mentions': [],
            u'hashtags': [
                {u'indices': [5, 11],
                 u'text': u'Python'},
            ],
            u'urls': [],
            }
        retweet = create_status(text=text,
                                entities=entities,
                                is_retweet=True,
                                retweeted_status=original_status)

        # retweet text gets parsed because sometimes is not complete
        expected_result = [u'I ', u'<3 ', ('hashtag', '#Python')]
        result = map_attributes(retweet,
                                hashtag='hashtag',
                                attag='attag',
                                url='url')

        self.assertEqual(result, expected_result)
开发者ID:diegorocha,项目名称:turses,代码行数:28,代码来源:test_ui.py

示例3: test_insert_different_statuses_individually

    def test_insert_different_statuses_individually(self):
        old_status = create_status(created_at=datetime(1988, 12, 19))
        new_status = create_status(id=2)

        # first
        self.timeline.add_status(old_status)
        self.assertEqual(len(self.timeline), 1)

        # second
        self.timeline.add_status(new_status)
        self.assertEqual(len(self.timeline), 2)
开发者ID:battlemidget,项目名称:turses,代码行数:11,代码来源:test_models.py

示例4: test_active_index_does_not_change_when_adding_various_statuses

    def test_active_index_does_not_change_when_adding_various_statuses(self):
        a_status = create_status(id=1)
        another_status = create_status(id=2)

        # first
        self.timeline.add_status(a_status)
        self.assertEqual(self.timeline.active_index, 0)

        # second
        self.timeline.add_status(another_status)
        self.assertEqual(self.timeline.active_index, 0)
开发者ID:battlemidget,项目名称:turses,代码行数:11,代码来源:test_models.py

示例5: test_clear

    def test_clear(self):
        old_created_at = datetime(1988, 12, 19)
        old_status = create_status(created_at=old_created_at)
        new_created_at = datetime.now()
        new_status = create_status(id=2,
                                   created_at=new_created_at)

        self.timeline.add_statuses([old_status, new_status])

        self.timeline.clear()

        self.assertEqual(len(self.timeline), 0)
开发者ID:battlemidget,项目名称:turses,代码行数:12,代码来源:test_models.py

示例6: test_authors_username_retweet

    def test_authors_username_retweet(self):
        user = 'turses'
        status = create_status(user=user)
        retweeter = 'bot'
        retweet = create_status(user=retweeter,
                                is_retweet=True,
                                retweeted_status=status,
                                author=user)

        author = retweet.authors_username

        self.assertEqual(user, author)
开发者ID:battlemidget,项目名称:turses,代码行数:12,代码来源:test_models.py

示例7: test_statuses_ordered_reversely_by_date

    def test_statuses_ordered_reversely_by_date(self):
        old_status = create_status(created_at=datetime(1988, 12, 19))
        new_status = create_status(id=2)

        # ordered
        self.timeline = Timeline(statuses=[new_status, old_status])
        self.assertEqual(self.timeline[0], new_status)
        self.assertEqual(self.timeline[1], old_status)

        # unordered
        self.timeline = Timeline(statuses=[old_status, new_status])
        self.assertEqual(self.timeline[0], new_status)
        self.assertEqual(self.timeline[1], old_status)
开发者ID:battlemidget,项目名称:turses,代码行数:13,代码来源:test_models.py

示例8: test_is_DM

    def test_is_DM(self):
        # status is NOT a DM
        status = create_status()
        self.failIf(is_DM(status))

        dm = create_direct_message()
        self.failUnless(is_DM(dm))
开发者ID:battlemidget,项目名称:turses,代码行数:7,代码来源:test_models.py

示例9: test_authors_username_tweet

    def test_authors_username_tweet(self):
        user = 'turses'
        status = create_status(user=user)

        author = status.authors_username

        self.assertEqual(user, author)
开发者ID:battlemidget,项目名称:turses,代码行数:7,代码来源:test_models.py

示例10: test_is_DM

    def test_is_DM(self):
        # status is NOT a DM
        status = create_status()
        self.assertFalse(is_DM(status))

        dm = create_direct_message()
        self.assertTrue(is_DM(dm))
开发者ID:fmartingr,项目名称:turses,代码行数:7,代码来源:test_models.py

示例11: test_unique_statuses_in_timeline

    def test_unique_statuses_in_timeline(self):
        status = create_status()

        self.timeline.add_status(status)
        self.timeline.add_status(status)

        self.assertEqual(len(self.timeline), 1)
开发者ID:battlemidget,项目名称:turses,代码行数:7,代码来源:test_models.py

示例12: test_thread

    def test_thread(self):
        status = create_status()

        thread_timeline = self.factory.thread(status)

        self.assertEqual(thread_timeline.update_function.__name__,
                         'get_thread',)
        self.assertEqual(thread_timeline._args[0], status)
开发者ID:fmartingr,项目名称:turses,代码行数:8,代码来源:test_api.py

示例13: test_unread_count

    def test_unread_count(self):
        self.assertEqual(self.timeline.unread_count, 0)

        # a status
        status = create_status(id=1)
        self.timeline.add_status(status)
        self.assertEqual(self.timeline.unread_count, 1)

        self.timeline.mark_all_as_read()
        self.assertEqual(self.timeline.unread_count, 0)

        # new statuses
        statuses = [create_status(id=id_num) for id_num in xrange(2, 10)]
        self.timeline.add_statuses(statuses)
        self.assertEqual(self.timeline.unread_count, len(statuses))

        self.timeline.mark_all_as_read()
        self.assertEqual(self.timeline.unread_count, 0)
开发者ID:battlemidget,项目名称:turses,代码行数:18,代码来源:test_models.py

示例14: test_dm_recipients_username_tweet

    def test_dm_recipients_username_tweet(self):
        # authenticating user
        user = 'turses'

        # given a status in which the author is the authenticated author
        # must return `None`
        status = create_status(user=user)
        recipient_own_tweet = status.dm_recipients_username(user)
        self.failIf(recipient_own_tweet)
开发者ID:battlemidget,项目名称:turses,代码行数:9,代码来源:test_models.py

示例15: test_thread_timeline

    def test_thread_timeline(self):
        active_timeline = self.controller.timelines.active
        active_timeline.add_status(create_status())
        # make sure that there is at least one status in the active timeline
        self.assertTrue(active_timeline.active)

        self.controller.append_thread_timeline()

        appended_timeline = self.timelines[-1]
        self.assertTrue(is_thread_timeline(appended_timeline))
开发者ID:noisufnoc,项目名称:turses,代码行数:10,代码来源:test_core.py


注:本文中的tests.create_status函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。