PandasSchema icon indicating copy to clipboard operation
PandasSchema copied to clipboard

Implementing __eq__ method to compare Schemas/Columns

Open CloseChoice opened this issue 4 years ago • 3 comments

I am creating schemas dynamically (from ddl schemas). It would be great if I could build some test and just do

expected_schema == result_schema

Right now I am doing the comparison like

for expected_col, result_col in zip(expected.columns, result.columns):
   for ex_val, res_val in zip(expected_col.validations, result_col.validations):
      assert type(ex_val) == type(res_val)

which is not accurate because the same types aren't necessarily the same validations especially if we are talking about custom validators.

CloseChoice avatar Oct 23 '20 11:10 CloseChoice

Seems like a reasonable request. I don't think it will be high priority for me, however.

multimeric avatar Oct 25 '20 12:10 multimeric

When I have time, I might look into that. You can assign me if you like to

CloseChoice avatar Oct 25 '20 18:10 CloseChoice

Happy for you to do that. I can probably easily port an implementation of __eq__ to the future branch once that becomes stable, too.

multimeric avatar Oct 26 '20 01:10 multimeric