def test_should_not_connect_twice_on_next_get_schema_from_parquet(self, mock_df): dal = ParquetDAL(self.dirname, self.sc) table = ParquetTable(self.table_name, schema_index_file=self.filename) dal.set_table(table) # here it gets schema too self.assertTrue(mock_df.parquet.called) mock_df.reset_mock() table.schema() self.assertFalse(mock_df.parquet.called)
def test_should_get_schema_from_parquet_with_schema_setter(self): table = ParquetTable(self.table_name) table.schema_index_file = self.filename self.dal.set_table(table) self.assertEqual(table.schema(), self.dataframe.keys())