Beispiel #1
0
    def test_display_flatten_a(self) -> None:
        config = DisplayConfig.from_default(type_color=False)

        d1 = Display.from_values(np.array([1, 2, 3, 4], dtype=np.int64),
                                 'header',
                                 config=config)
        self.assertEqual(d1.flatten().to_rows(), ['header 1 2 3 4 <int64>'])

        d2 = Display.from_values(np.array([5, 6, 7, 8], dtype=np.int64),
                                 'header',
                                 config=config)

        # mutates in place
        d1.extend_display(d2)
        self.assertEqual(d1.to_rows(), [
            'header  header', '1       5', '2       6', '3       7',
            '4       8', '<int64> <int64>'
        ])

        self.assertEqual(d1.flatten().to_rows(),
                         ['header header 1 5 2 6 3 7 4 8 <int64> <int64>'])

        self.assertEqual(d1.transform().to_rows(),
                         ['header 1 2 3 4 <int64>', 'header 5 6 7 8 <int64>'])
Beispiel #2
0
 def test_display_config_a(self) -> None:
     config = DisplayConfig.from_default(type_color=False)
     d = Display.from_values(np.array([[1, 2], [3, 4]], dtype=np.int64),
                             'header',
                             config=config)
     self.assertEqual(d.to_rows(), ['header', '1 2', '3 4', '<int64>'])