コード例 #1
0
ファイル: test_tabview.py プロジェクト: JPFrancoia/tabview
 def test_tabview_unicode(self):
     curses.wrapper(self.main,
                    t.process_data(self.data(data_1[0])),
                    start_pos=(5, 5),
                    column_width='mode',
                    column_gap=2,
                    column_widths=None,
                    trunc_char='…',
                    search_str=None)
コード例 #2
0
ファイル: test_tabview.py プロジェクト: qb45532/tabview
 def test_tabview_file_annotated_comment(self):
     self.tabview_file(data_3)
     # Test removal of comment mark in first line
     sample_data = res3[0]
     res = t.process_data(self.data(data_3[0]))
     for j, i in enumerate(sample_data):
         try:
             i = i.decode('utf-8')
         except AttributeError:
             i = str(i)
         self.assertEqual(i, res[0][j])
コード例 #3
0
ファイル: test_tabview.py プロジェクト: JPFrancoia/tabview
 def test_tabview_pandas_series(self):
     curses.wrapper(self.main,
                    t.process_data(
                        pd.read_csv(data_2[0], encoding='latin-1').iloc[:,
                                                                        0]),
                    start_pos=(0, 0),
                    column_width=20,
                    column_gap=2,
                    column_widths=None,
                    trunc_char='…',
                    search_str=None)
コード例 #4
0
ファイル: test_tabview.py プロジェクト: interrogator/tabview
 def test_tabview_file_annotated_comment(self):
     self.tabview_file(data_3)
     # Test removal of comment mark in first line
     sample_data = res3[0]
     res = t.process_data(self.data(data_3[0]))
     for j, i in enumerate(sample_data):
         try:
             i = i.decode('utf-8')
         except AttributeError:
             i = str(i)
         self.assertEqual(i, res[0][j])
コード例 #5
0
    def tabview_file(self, info):
        """Test that data processed from a unicode file matches the sample data
        above

        """
        fn, _, sample_data = info
        res = t.process_data(self.data(fn))
        # Check that process_file returns a list of lists
        self.assertEqual(type(res), list)
        self.assertEqual(type(res[0]), list)
        # Have to decode res1 and res2 from utf-8 so they can be compared to
        # the results from the file, which are string (py3)
        for j, i in enumerate(sample_data):
            i = str(i)
            self.assertEqual(i, res[-1][j])
コード例 #6
0
ファイル: test_tabview.py プロジェクト: autoscatto/tabview
    def tabview_file(self, info):
        """Test that data processed from a unicode file matches the sample data
        above

        """
        fn, _, sample_data = info
        code = 'utf-8'  # Per top line of file
        res = t.process_data(self.data(fn))
        # Check that process_file returns a list of lists
        self.assertEqual(type(res), list)
        self.assertEqual(type(res[0]), list)
        # Have to decode res1 and res2 from utf-8 so they can be compared to
        # the results from the file, which are unicode (py2) or string (py3)
        for j, i in enumerate(sample_data):
            try:
                i = i.decode(code)
            except AttributeError:
                i = str(i)
            self.assertEqual(i, res[-1][j])
コード例 #7
0
ファイル: test_tabview.py プロジェクト: JPFrancoia/tabview
    def tabview_file(self, info):
        """Test that data processed from a unicode file matches the sample data
        above

        """
        fn, _, sample_data = info
        code = 'utf-8'  # Per top line of file
        # Check that process_file returns a dict
        fn_proc = t.process_data(self.data(fn))
        self.assertEqual(type(fn_proc), dict)
        # Check that the header is the same length as the data
        self.assertEqual(len(fn_proc['header']), len(fn_proc['data'][0]))
        # Check that 'data' is a list of lists
        res = fn_proc['data']
        self.assertEqual(type(res), list)
        self.assertEqual(type(res[0]), list)
        # Have to decode res1 and res2 from utf-8 so they can be compared to
        # the results from the file, which are unicode (py2) or string (py3)
        for j, i in enumerate(sample_data):
            try:
                i = i.decode(code)
            except AttributeError:
                i = str(i)
            self.assertEqual(i, res[-1][j])
コード例 #8
0
ファイル: test_tabview.py プロジェクト: interrogator/tabview
 def test_tabview_unicode(self):
     curses.wrapper(self.main, t.process_data(self.data(data_1[0])),
                    start_pos=(5, 5), column_width='mode', column_gap=2,
                    column_widths=None, trunc_char='…', search_str=None)
コード例 #9
0
ファイル: test_tabview.py プロジェクト: interrogator/tabview
 def test_tabview_annotated_comment(self):
     curses.wrapper(self.main, t.process_data(self.data(data_3[0])),
                    start_pos=(0, 1), column_width='mode', column_gap=2,
                    column_widths=None, trunc_char='…', search_str=None)
コード例 #10
0
ファイル: test_tabview.py プロジェクト: interrogator/tabview
 def test_tabview_pandas_series(self):
     curses.wrapper(self.main, t.process_data(pd.read_csv(data_2[0], encoding='latin-1').iloc[:,0]),
                    start_pos=(0, 0), column_width=20, column_gap=2,
                    column_widths=None, trunc_char='…',
                    search_str=None)
コード例 #11
0
ファイル: test_tabview.py プロジェクト: interrogator/tabview
 def test_tabview_pandas_dataframe(self):
     curses.wrapper(self.main, t.process_data(pd.read_csv(data_1[0])),
                    start_pos=(0, 0), column_width='mode', column_gap=2,
                    column_widths=None, trunc_char='…',
                    search_str=None)
コード例 #12
0
ファイル: test_tabview.py プロジェクト: interrogator/tabview
 def test_tabview_array_1d(self):
     curses.wrapper(self.main, t.process_data(np_array_1),
                    start_pos=(0, 0), column_width=20, column_gap=2,
                    column_widths=None, trunc_char='…',
                    search_str=None)
コード例 #13
0
ファイル: test_tabview.py プロジェクト: interrogator/tabview
 def test_tabview_dict_index(self):
     curses.wrapper(self.main, t.process_data(dict_1, orient='index'),
                    start_pos=(0, 0), column_width=20, column_gap=2,
                    column_widths=None, trunc_char='…',
                    search_str=None)
コード例 #14
0
ファイル: test_tabview.py プロジェクト: interrogator/tabview
 def test_tabview_list(self):
     curses.wrapper(self.main, t.process_data(list_1),
                    start_pos=0, column_width=5, column_gap=10,
                    column_widths=[4, 5, 1], trunc_char='>',
                    search_str=None)
コード例 #15
0
ファイル: test_tabview.py プロジェクト: interrogator/tabview
 def test_tabview_latin1(self):
     curses.wrapper(self.main, t.process_data(self.data(data_2[0])),
                    start_pos=5, column_width='max', column_gap=0,
                    column_widths=None, trunc_char='…', search_str='36')
コード例 #16
0
ファイル: tabview.py プロジェクト: pombredanne/guild
 def _init_data(self):
     data, logs = self.get_data()
     return tabview.process_data(data), logs
コード例 #17
0
ファイル: test_tabview.py プロジェクト: autoscatto/tabview
 def test_tabview_windows_newlines(self):
     curses.wrapper(self.main, t.process_data(self.data(win_newlines)),
                    start_pos=(0, 1), column_width='mode', column_gap=5,
                    column_widths=None, trunc_char='…', search_str=None)
コード例 #18
0
 def _init_data(self):
     # pylint: disable=not-callable
     data, logs = self.get_data()
     return tabview.process_data(data), logs