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


Python models.Timeline类代码示例

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


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

示例1: test_update_with_no_args_extra_kwargs

    def test_update_with_no_args_extra_kwargs(self):
        mock = MagicMock(name='update')
        timeline = Timeline(update_function=mock,)
        extra_kwargs = {'python': 'rocks'}
        timeline.update_with_extra_kwargs(**extra_kwargs)

        mock.assert_called_once_with(**extra_kwargs)
开发者ID:gigigi,项目名称:turses,代码行数:7,代码来源:test_models.py

示例2: test_update_with_no_args

    def test_update_with_no_args(self):
        mock = MagicMock(name='update')
        timeline = Timeline(update_function=mock,)

        timeline.update()

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

示例3: test_update_with_kwargs

    def test_update_with_kwargs(self):
        mock = MagicMock(name='update')
        kwargs = {'text': '#python', 'action': 'search'}
        timeline = Timeline(update_function=mock,
                            update_function_kwargs=kwargs)
        timeline.update()

        mock.assert_called_once_with(**kwargs)
开发者ID:battlemidget,项目名称:turses,代码行数:8,代码来源:test_models.py

示例4: test_update_with_one_arg_extra_kwargs

    def test_update_with_one_arg_extra_kwargs(self):
        mock = MagicMock(name='update')
        arg = '#python'
        timeline = Timeline(update_function=mock, update_function_args=arg)
        extra_kwargs = {'python': 'rocks'}
        timeline.update_with_extra_kwargs(**extra_kwargs)

        mock.assert_called_once_with(arg, **extra_kwargs)
开发者ID:gigigi,项目名称:turses,代码行数:8,代码来源:test_models.py

示例5: test_update_with_one_arg

    def test_update_with_one_arg(self):
        mock = MagicMock(name='update')
        arg = '#python'
        timeline = Timeline(update_function=mock, 
                            update_function_args=arg)
        timeline.update()

        mock.assert_called_once_with(arg)
开发者ID:gigigi,项目名称:turses,代码行数:8,代码来源:test_models.py

示例6: test_update_with_multiple_args

    def test_update_with_multiple_args(self):
        mock = MagicMock(name='update')
        args = '#python', '#mock'
        timeline = Timeline(update_function=mock,
                            update_function_args=args)
        timeline.update()

        args = list(args)
        mock.assert_called_once_with(*args)
开发者ID:battlemidget,项目名称:turses,代码行数:9,代码来源:test_models.py

示例7: test_update_with_multiple_args_extra_kwargs

    def test_update_with_multiple_args_extra_kwargs(self):
        mock = MagicMock(name='update')
        args = ('#python', '#mock')
        timeline = Timeline(update_function=mock, 
                            update_function_args=args)
        extra_kwargs = {'python': 'rocks'}
        timeline.update_with_extra_kwargs(**extra_kwargs)

        args = list(args)
        mock.assert_called_once_with(*args, **extra_kwargs)
开发者ID:gigigi,项目名称:turses,代码行数:10,代码来源:test_models.py

示例8: test_update_with_kwargs_extra_kwargs

    def test_update_with_kwargs_extra_kwargs(self):
        mock = MagicMock(name='update')
        kwargs = {'text': '#python', 'action': 'search'}
        timeline = Timeline(update_function=mock, 
                            update_function_kwargs=kwargs)
        extra_kwargs = {'text': 'rocks'}
        timeline.update_with_extra_kwargs(**extra_kwargs)

        args = kwargs.copy()
        args.update(extra_kwargs)
        mock.assert_called_once_with(**args)
开发者ID:gigigi,项目名称:turses,代码行数:11,代码来源:test_models.py

示例9: 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

示例10: test_update_with_args_and_kwargs

    def test_update_with_args_and_kwargs(self):
        mock = MagicMock(name='update')
        args = 'twitter', 42 
        kwargs = {'text': '#python', 'action': 'search'}
        update_args = list(args)
        update_args.append(kwargs)
        timeline = Timeline(update_function=mock, 
                            update_function_args=args,
                            update_function_kwargs=kwargs)
        timeline.update()

        args = list(args)
        mock.assert_called_once_with(*args, **kwargs)
开发者ID:gigigi,项目名称:turses,代码行数:13,代码来源:test_models.py

示例11: test_update_with_args_and_kwargs_extra_kwargs

    def test_update_with_args_and_kwargs_extra_kwargs(self):
        mock = MagicMock(name='update')
        args = 'twitter', 42
        kwargs = {'text': '#python', 'action': 'search'}
        extra_kwargs = {'text': 'rocks'}

        timeline = Timeline(update_function=mock,
                            update_function_args=args,
                            update_function_kwargs=kwargs)
        timeline.update(**extra_kwargs)

        args = list(args)
        kwargs = kwargs.copy()
        kwargs.update(extra_kwargs)
        mock.assert_called_once_with(*args, **kwargs)
开发者ID:battlemidget,项目名称:turses,代码行数:15,代码来源:test_models.py

示例12: append_timeline

 def append_timeline(self,
                     name,
                     update_function,
                     update_args=None,
                     update_kwargs=None):
     """
     Given a name, function to update a timeline and optionally
     arguments to the update function, it creates the timeline and
     appends it to `timelines`.
     """
     timeline = Timeline(name=name,
                         update_function=update_function,
                         update_function_args=update_args,
                         update_function_kwargs=update_kwargs)
     timeline.update()
     timeline.activate_first()
     self.timelines.append_timeline(timeline)
开发者ID:battlemidget,项目名称:turses,代码行数:17,代码来源:core.py

示例13: test_active_index_is_0_when_creating_timeline_with_statuses

    def test_active_index_is_0_when_creating_timeline_with_statuses(self):
        status = create_status()

        self.timeline = Timeline(statuses=[status])

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

示例14: setUp

 def setUp(self):
     self.timeline = Timeline()
     self.assert_null_index()
开发者ID:battlemidget,项目名称:turses,代码行数:3,代码来源:test_models.py

示例15: setUp

 def setUp(self):
     self.timeline = Timeline()
     self.timeline.clear()
     self.assertEqual(len(self.timeline), 0)
     self.assertEqual(self.timeline.active_index, ActiveList.NULL_INDEX)
开发者ID:gigigi,项目名称:turses,代码行数:5,代码来源:test_models.py


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