Include helper function to test chart equality? #3759
Replies: 3 comments
-
This would be very handy! One issue will be the global counter for parameter names, see #3416 where this came up for Streamlit. See here how they solved it on their side. |
Beta Was this translation helpful? Give feedback.
-
Interesting suggestion! Where will these proposed functions be located? Within eg a new module like |
Beta Was this translation helpful? Give feedback.
-
I'm teaching a new undergrad course in data visualization (with Altair as the library) and this would be really useful for me to test/compare charts and plots with an autograder. Ultimately I want something like this, from VizGrader |
Beta Was this translation helpful? Give feedback.
-
What is your suggestion?
Would it be useful to have the equivalent of pandas
assert_frame_equal
for Altair charts? I was drafting a function for this to use when grading student submissions and thought maybe it would be beneficial to have more widely available.Example usage:
and
Function draft
This could be extended to e.g. optionally exclude keys from comparisons (such as the data/datasets which should probably be excluded by default).
Have you considered any alternative solutions?
If we don't see a reason to include this in the main library, I can put it in altair ally, although it wouldn't be as visible or easy to access there.
There are already some packages that assert equality of dictionaries and json specs (e.g. deepdiff), but they don't have that easy to understand error messages and seem like unnecessary dependencies to take on.
Beta Was this translation helpful? Give feedback.
All reactions