def test_columns_out_of_order(self):
     """Tests validating wrong column order."""
     with self.assertRaises(AttributeError):
         df2 = self.test_df.copy()
         cols = ['image_uri', 'split', 'label']
         df2 = df2[cols]
         client._validate_data(df2)
Exemple #2
0
 def test_missing_split(self):
     """Tests missing split column."""
     split_key = 'split'
     schema_keys = re.escape(str(list(self.test_schema_map.keys())))
     regex = fr'^.+column: {split_key}.+keys: {schema_keys}.$'
     with self.assertRaisesRegex(AttributeError, regex):
         df2 = self.test_df.copy()
         df2.drop(split_key, inplace=True, axis=1)
         client._validate_data(df2, schema.image_csv_schema)
 def test_missing_image(self):
     """Tests missing image column."""
     with self.assertRaises(AttributeError):
         df2 = self.test_df.copy()
         df2.drop('image_uri', inplace=True, axis=1)
         client._validate_data(df2)
 def test_valid_dataframe(self):
     """Tests valid DataFrame input."""
     self.assertIsNone(client._validate_data(self.test_df))
 def test_missing_split(self):
     """Tests missing split column."""
     with self.assertRaises(AttributeError):
         df2 = self.test_df.copy()
         df2.drop('split', inplace=True, axis=1)
         client._validate_data(df2, schema.image_csv_schema)
 def test_valid_dataframe(self):
     """Tests valid DataFrame input."""
     self.assertIsNone(
         client._validate_data(self.test_df, schema.image_csv_schema))