multimeric / PandasSchema

A validation library for Pandas data frames using user-friendly schemas
https://multimeric.github.io/PandasSchema/
GNU General Public License v3.0
189 stars 35 forks source link

Implementing __eq__ method to compare Schemas/Columns #42

Open CloseChoice opened 3 years ago

CloseChoice commented 3 years ago

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.

multimeric commented 3 years ago

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

CloseChoice commented 3 years ago

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

multimeric commented 3 years ago

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