def create_sample_table(self):
     table_info = DataFrameMetadata("dataset", 'dataset')
     column_1 = DataFrameColumn("id", ColumnType.INTEGER, False)
     column_2 = DataFrameColumn("data", ColumnType.NDARRAY, False,
                                [2, 2, 3])
     table_info.schema = [column_1, column_2]
     return table_info
Example #2
0
    def test_df_metadata_equality(self):
        df_metadata = DataFrameMetadata('name', 'eva_dataset')
        column_1 = DataFrameColumn("frame_id", ColumnType.INTEGER, False)
        column_2 = DataFrameColumn("frame_label", ColumnType.INTEGER, False)
        col_list = [column_1, column_2]
        df_metadata.schema = col_list
        self.assertEqual(df_metadata, df_metadata)

        df_metadata1 = DataFrameMetadata('name2', 'eva_dataset')
        column_1 = DataFrameColumn("frame_id", ColumnType.INTEGER, False)
        column_2 = DataFrameColumn("frame_label", ColumnType.INTEGER, False)
        col_list = [column_1, column_2]
        df_metadata1.schema = col_list
        self.assertNotEqual(df_metadata, df_metadata1)
        df_metadata2 = DataFrameMetadata('name2', 'eva_dataset')
        df_metadata2.schema = col_list[1:]
        self.assertNotEqual(df_metadata1, df_metadata2)
Example #3
0
    def test_df_metadata(self):
        df_metadata = DataFrameMetadata('name', 'eva_dataset')
        column_1 = DataFrameColumn("frame_id", ColumnType.INTEGER, False)
        column_2 = DataFrameColumn("frame_label", ColumnType.INTEGER, False)
        col_list = [column_1, column_2]
        schema = DataFrameSchema('name', col_list)
        df_metadata.schema = col_list

        self.assertEqual(df_metadata.name, 'name')
        self.assertEqual(df_metadata.file_url, 'eva_dataset')
        self.assertEqual(df_metadata.id, None)
        self.assertEqual(df_metadata.identifier_column, 'id')
        self.assertEqual(df_metadata.schema, schema)