spacetelescope / cubeviz

Data analysis package for cubes. https://cubeviz.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
15 stars 25 forks source link

Stats box tests in image viewer #529

Closed javerbukh closed 5 years ago

javerbukh commented 5 years ago

The current test checks to see that the data presented in the image viewer stats area is parsed correctly. However, the original code uses many different parameters and functions in order to work, so it was difficult to write tests without using some of the image_viewer functions. Any recommended changes or improvements are welcome.

Resolves #513

codecov[bot] commented 5 years ago

Codecov Report

Merging #529 into master will increase coverage by 0.17%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #529      +/-   ##
==========================================
+ Coverage   64.16%   64.33%   +0.17%     
==========================================
  Files          39       40       +1     
  Lines        4956     4980      +24     
==========================================
+ Hits         3180     3204      +24     
  Misses       1776     1776
Impacted Files Coverage Δ
cubeviz/tests/test_image_viewer.py 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 861d9d3...9081704. Read the comment docs.

brechmos-stsci commented 5 years ago

@javerbukh There are a lot of levels of what could be compared here.

I think it might be better to create the ROI and grab the text of the number at the bottom of the viewer. Then compare that text, represented as a floating point number, to the actual expected number.

This way we are testing the actual number people will use to what we expect. It is that number which they might use for science or for interpreting science, so I think we should check it. Does that make sense?

brechmos-stsci commented 5 years ago

I like this test. Funny, I would have tried parsing the string to get the numbers, and then compare the numbers etc etc, this is so much simpler and better. :)