本文整理汇总了Python中turses.models.Timeline.update方法的典型用法代码示例。如果您正苦于以下问题:Python Timeline.update方法的具体用法?Python Timeline.update怎么用?Python Timeline.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类turses.models.Timeline
的用法示例。
在下文中一共展示了Timeline.update方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_update_with_no_args
# 需要导入模块: from turses.models import Timeline [as 别名]
# 或者: from turses.models.Timeline import update [as 别名]
def test_update_with_no_args(self):
mock = MagicMock(name='update')
timeline = Timeline(update_function=mock,)
timeline.update()
mock.assert_called_once_with()
示例2: test_update_with_no_args_extra_kwargs
# 需要导入模块: from turses.models import Timeline [as 别名]
# 或者: from turses.models.Timeline import update [as 别名]
def test_update_with_no_args_extra_kwargs(self):
mock = MagicMock(name='update')
extra_kwargs = {'python': 'rocks'}
timeline = Timeline(update_function=mock,)
timeline.update(**extra_kwargs)
mock.assert_called_once_with(**extra_kwargs)
示例3: test_update_with_kwargs
# 需要导入模块: from turses.models import Timeline [as 别名]
# 或者: from turses.models.Timeline import update [as 别名]
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)
示例4: test_update_with_one_arg
# 需要导入模块: from turses.models import Timeline [as 别名]
# 或者: from turses.models.Timeline import update [as 别名]
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)
示例5: test_update_with_one_arg_extra_kwargs
# 需要导入模块: from turses.models import Timeline [as 别名]
# 或者: from turses.models.Timeline import update [as 别名]
def test_update_with_one_arg_extra_kwargs(self):
mock = MagicMock(name='update')
arg = '#python'
extra_kwargs = {'python': 'rocks'}
timeline = Timeline(update_function=mock, update_function_args=arg)
timeline.update(**extra_kwargs)
mock.assert_called_once_with(arg, **extra_kwargs)
示例6: test_update_with_multiple_args
# 需要导入模块: from turses.models import Timeline [as 别名]
# 或者: from turses.models.Timeline import update [as 别名]
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)
示例7: test_update_with_multiple_args_extra_kwargs
# 需要导入模块: from turses.models import Timeline [as 别名]
# 或者: from turses.models.Timeline import update [as 别名]
def test_update_with_multiple_args_extra_kwargs(self):
mock = MagicMock(name='update')
args = ('#python', '#mock')
extra_kwargs = {'python': 'rocks'}
timeline = Timeline(update_function=mock,
update_function_args=args)
timeline.update(**extra_kwargs)
args = list(args)
mock.assert_called_once_with(*args, **extra_kwargs)
示例8: test_update_with_args_and_kwargs
# 需要导入模块: from turses.models import Timeline [as 别名]
# 或者: from turses.models.Timeline import update [as 别名]
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)
示例9: test_update_with_args_and_kwargs_extra_kwargs
# 需要导入模块: from turses.models import Timeline [as 别名]
# 或者: from turses.models.Timeline import update [as 别名]
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)
示例10: append_timeline
# 需要导入模块: from turses.models import Timeline [as 别名]
# 或者: from turses.models.Timeline import update [as 别名]
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)