Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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])
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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])
Exemplo n.º 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])
Exemplo n.º 6
0
    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])
Exemplo n.º 7
0
    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])
Exemplo n.º 8
0
 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)
Exemplo n.º 9
0
 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)
Exemplo n.º 10
0
 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)
Exemplo n.º 11
0
 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)
Exemplo n.º 12
0
 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)
Exemplo n.º 13
0
 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)
Exemplo n.º 14
0
 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)
Exemplo n.º 15
0
 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')
Exemplo n.º 16
0
 def _init_data(self):
     data, logs = self.get_data()
     return tabview.process_data(data), logs
Exemplo n.º 17
0
 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)
Exemplo n.º 18
0
 def _init_data(self):
     # pylint: disable=not-callable
     data, logs = self.get_data()
     return tabview.process_data(data), logs