def testLargeRowsFormatter(self): data = [self._random_values() for _ in range(1000)] pd = ResultFrame(data=data, schema=self.schema, pandas=True) result = ResultFrame(data=data, schema=self.schema, pandas=False) self.assertEqual(to_str(repr(pd)), to_str(repr(result))) self.assertEqual(to_str(pd._repr_html_()), to_str(result._repr_html_()))
def testSmallRowsFormatter(self): data = [self._random_values() for _ in range(10)] pd = ResultFrame(data=data, schema=self.schema, pandas=True) result = ResultFrame(data=data, schema=self.schema, pandas=False) self.assertEqual(to_str(repr(pd)), to_str(repr(result))) self.assertEqual(to_str(pd._repr_html_()), to_str(result._repr_html_())) self.assertEqual(result._values, [r for r in result])
def testSmallRowsFormatter(self): data = [self._random_values() for _ in range(10)] data[-1][0] = None pd = ResultFrame(data=data, schema=self.schema, pandas=True) result = ResultFrame(data=data, schema=self.schema, pandas=False) self.assertEqual(to_str(repr(pd)), to_str(repr(result))) self.assertEqual(to_str(pd._repr_html_()), to_str(result._repr_html_())) self.assertEqual(result._values, [r for r in result])
def testLargeColumnsFormatter(self): names = list(itertools.chain(*[[name + str(i) for name in self.schema.names] for i in range(10)])) types = self.schema.types * 10 schema = Schema.from_lists(names, types) gen_row = lambda: list(itertools.chain(*(self._random_values().values for _ in range(10)))) data = [Record(schema=df_schema_to_odps_schema(schema), values=gen_row()) for _ in range(10)] pd = ResultFrame(data=data, schema=schema, pandas=True) result = ResultFrame(data=data, schema=schema, pandas=False) self.assertEqual(to_str(repr(pd)), to_str(repr(result))) self.assertEqual(to_str(pd._repr_html_()), to_str(result._repr_html_()))