Пример #1
0
    def test_df_equality(self):
        df_col = DataFrameColumn('name', ColumnType.TEXT, is_nullable=False)
        self.assertEqual(df_col, df_col)
        df_col1 = DataFrameColumn('name2', ColumnType.TEXT, is_nullable=False)
        self.assertNotEqual(df_col, df_col1)
        df_col1 = DataFrameColumn('name',
                                  ColumnType.INTEGER,
                                  is_nullable=False)
        self.assertNotEqual(df_col, df_col1)
        df_col1 = DataFrameColumn('name', ColumnType.INTEGER, is_nullable=True)
        self.assertNotEqual(df_col, df_col1)
        df_col1 = DataFrameColumn('name',
                                  ColumnType.INTEGER,
                                  is_nullable=False)
        self.assertNotEqual(df_col, df_col1)
        df_col.array_dimensions = [2, 4]
        df_col1 = DataFrameColumn('name',
                                  ColumnType.INTEGER,
                                  is_nullable=False,
                                  array_dimensions=[1, 2])
        self.assertNotEqual(df_col, df_col1)

        df_col.metadata_id = 1
        df_col1 = DataFrameColumn('name',
                                  ColumnType.INTEGER,
                                  is_nullable=False,
                                  array_dimensions=[2, 4],
                                  metadata_id=2)
        self.assertNotEqual(df_col, df_col1)
Пример #2
0
 def test_df_column(self):
     df_col = DataFrameColumn('name', ColumnType.TEXT, is_nullable=False)
     df_col.array_dimensions = [1, 2]
     df_col.metadata_id = 1
     self.assertEqual(df_col.array_dimensions, [1, 2])
     self.assertEqual(df_col.is_nullable, False)
     self.assertEqual(df_col.name, 'name')
     self.assertEqual(df_col.type, ColumnType.TEXT)
     self.assertEqual(df_col.metadata_id, 1)
     self.assertEqual(df_col.id, None)
     self.assertEqual(str(df_col), 'Column: (name, TEXT, False, [1, 2])')