コード例 #1
0
ファイル: test_pick.py プロジェクト: simonbru/pick
 def test_get_lines(self):
     title = 'Please choose an option: '
     options = ['option1', 'option2', 'option3']
     picker = Picker(options, title, indicator='*')
     lines, current_line = picker.get_lines()
     assert lines == [title, '', '* option1', '  option2', '  option3']
     assert current_line == 3
コード例 #2
0
ファイル: test_pick.py プロジェクト: eth0izzle/pick
 def test_get_lines(self):
     title = 'Please choose an option: '
     options = ['option1', 'option2', 'option3']
     picker = Picker(options, title, indicator='*')
     lines, current_line = picker.get_lines()
     assert lines == [title, '', '* option1', '  option2', '  option3']
     assert current_line == 3
コード例 #3
0
ファイル: test_pick.py プロジェクト: yijin-herb/pick
    def test_options_map_func(self):
        title = 'Please choose an option: '
        options = [{'label': 'option1'}, {'label': 'option2'}, {'label': 'option3'}]

        def get_label(option): return option.get('label')

        picker = Picker(options, title, indicator='*', options_map_func=get_label)
        lines, current_line = picker.get_lines()
        assert lines == [title, '', '* option1', '  option2', '  option3']
        assert picker.get_selected() == ({ 'label': 'option1' }, 0)
コード例 #4
0
ファイル: test_pick.py プロジェクト: simonbru/pick
 def test_no_title(self):
     options = ['option1', 'option2', 'option3']
     picker = Picker(options)
     lines, current_line = picker.get_lines()
     assert current_line == 1
コード例 #5
0
ファイル: test_pick.py プロジェクト: eth0izzle/pick
 def test_no_title(self):
     options = ['option1', 'option2', 'option3']
     picker = Picker(options)
     lines, current_line = picker.get_lines()
     assert current_line == 1