Пример #1
0
    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)
Пример #2
0
    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)
Пример #3
0
    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)
Пример #4
0
    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)
Пример #5
0
    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)
Пример #6
0
    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)
Пример #7
0
    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)
Пример #8
0
    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)