Replies: 7 comments
-
|
See #1555 for analysis and fix. We have a gap in testing, in that no (or maybe just a few?) tests check the generated SVG graphics. The tests in test_plot_detail.py can easily be enhanced to check that the SVG graphics for all the doctests aren't changed. If you'd like we can leave this issue open, assigned to me, to do that. |
Beta Was this translation helpful? Give feedback.
-
|
I also submitted PR #1556, which is #1555 plus SVG tests. Please double-check one or the other, depending on whether you're ok with adding the SVG tests. I think they will help prevent mishaps like this in the future. |
Beta Was this translation helpful? Give feedback.
-
|
As noted on PR #1556, it's probably too fragile, so suggest just going with PR #1555 at this point. |
Beta Was this translation helpful? Give feedback.
-
Ok. As often happens here, there are good ideas, e. g., more robust testing or using compilation (or a more aggressive transformation) to speed up computation. But these ideas need iteration over time to get right. I haven't been following the testing process in detail, other than we're testing at the S-expression level (as opposed to a rendered SVG level), which is a good thing. The obvious things that would seem to be needed are:
|
Beta Was this translation helpful? Give feedback.
-
|
Some thoughts and experiences regarding testing plotting functions: There are three places in the graphics pipeline where we could do testing:
I think these tests are all useful and are complementary. For example, Regarding the idea to do more sophisticated comparisons than simple On the other hand I found the doctest-based tests that were recently |
Beta Was this translation helpful? Give feedback.
-
As you say, it is also fragile and voluminous, both in the codebase and in changelogs. It doesn't really give us insight as to the changing nature of the underlying system, that numpy on some OSs and some Python versions and some numpy versions can use integers or floats (if that's the case), and that's okay. While this kind of thing might be captured with the addition of comments, I noted that when "3" was changed to "3.1" no comment appeared there, but instead in a place where it is less likely to be seen. With more work on a specific graphics testing system, it could be more declarative: that certain error bounds on values are okay, and maybe certain kinds of datatypes too (both float, and int, i.e., just numbers versus, say, must always be int). Or there could be a declaration of the dimensions and sizes of data. Explicit declaration is better than implicit, for example using 3.1 to try to constrain output to be floating point.
The mathics-core SVG implementation currently always outputs in some kind of pretty-printed form for this reason.
Testing of Plotly+Panel or any kind of add-on should be done inside the add-on system. It might be okay to have such individual tests inside the core if they run on demand, or on a time-based schedule, as opposed to running after every little commit. And large-scale graphics should probably be isolated to its own test suite which is run in parallel rather than in sequence as part of the usual tests, which are expected to run relatively quickly.
I don't know what exactly you mean by doctest-based tests. Keep in mind that, in the long term, the homegrown doctest system will be replaced with something more standard. So extending our homegrown system is not a good idea, but if you want to extend something based on, say, Sphinx, or a non-homegrown system that is better suited for these kinds of things, that would be fine. |
Beta Was this translation helpful? Give feedback.
-
Fair point. This would make a great comment on the PR.
That was the effect of limiting the precision in the textual output for the Plot*->Graphics* tests.
That could be accomplished in the system based on text diffs by outputting "number" instead of the actual datatype. I contemplated doing that as a result of the case you mention above where 3 appeared as int on some systems and float on others, but opted not to because so far I've only seen this in that one test case. If this (int vs float confusion) occurs again I will probably make that change.
It's printed one SVG element per line, which is a start, but some of those lines can get quite long (e.g. a long polyline with many points is on a single line, along with other attributes describing color, style, etc.). What I had in mind is that for more effective diffing it could be printed in a form that shows each attribute on a separate line, indented to show containment, and breaks down points attributes so that each point is on a separate line. (I'm not necessarily suggesting that svg normally be generated in this form - I'm describing the form used for diffing in tests). But that, along with limiting precision, is work (and I'm not planning on doing it, at least not in the near future).
Right, agree. I just mentioned that case here for completeness. What could be done easily in core is the Plot*->Graphics*->SVG->PNG image-based test. (This requires something like cairosvg, so assuming that won't be made a core requirement the test would have to be conditioned on its availablity. TBD when and how it gets run.)
Yes, sorry, that was vague and a bit of a misnomer. In the plot testing directory there is a file doc_tests.yaml that describes 120 or so tests originally obtained from doctests. But the mechanism (and the current set of tests) is not specific to doctests: the test case is run, the result is pretty-printed in outline form, and diffed against a reference file. So what I was saying is that in practice I have found that mechanism effective: easy to set up, easy to interpret, and it gives very broad coverage. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Recent changes seem to have broken non-vector-mode tick marks in
ListPlot[]How to Reproduce
Output Given
Expected behavior
No logplot scale, y axis goes from 0 to 2.
Your Environment
Current Mathics core development environment 9.0.1.dev0 and same for mathicsscript
mathics --version
Workarounds
Use last release ;-)
Beta Was this translation helpful? Give feedback.
All reactions