Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding tests for timeseries module #219

Closed

Conversation

marty-larocque
Copy link
Contributor

@marty-larocque marty-larocque commented Mar 16, 2020

This PR adds tests for the timeseries module, addressing issue #186. It also changes the method for using assert_xy() with datetime data, addressing issue #169 .

Additionally, it implements some minor tweaks to how assert_xy() compares data, addressing issues #232 and #233.

@codecov
Copy link

codecov bot commented Mar 16, 2020

Codecov Report

Merging #219 into master will increase coverage by 1.04%.
The diff coverage is 90.24%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #219      +/-   ##
==========================================
+ Coverage   79.95%   80.99%   +1.04%     
==========================================
  Files          19       20       +1     
  Lines        1831     1863      +32     
==========================================
+ Hits         1464     1509      +45     
+ Misses        367      354      -13     
Impacted Files Coverage Δ
matplotcheck/base.py 87.66% <50.00%> (-0.05%) ⬇️
matplotcheck/tests/test_timeseries_module.py 100.00% <100.00%> (ø)
matplotcheck/timeseries.py 21.66% <0.00%> (+21.66%) ⬆️

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 eab6e72...c3990da. Read the comment docs.

return TimeSeriesTester(axis)


"""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will merge this for now but i think we should pull this documentation out into an issue somewhere rather than leaving it in the code.

Copy link

@lwasser lwasser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once ci rebuilds we can merge this. it essentially removes the xtime variable as we have discussed and thus avoids the issues associated with converting datetime objects.

@lwasser
Copy link

lwasser commented Apr 20, 2020

@ryla5068 have you updated from master lately? i believe this pr is failing because it's missing some fixes from master. can you do an update and ping me when it's done and i'll watch CI again?

Copy link

@lwasser lwasser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs an update from master so CI passes

@lwasser
Copy link

lwasser commented Apr 23, 2020

@nkorinek can you help me finish up this pr? let's go ahead and create a new branch off of this one and update from master to see if CI is happy. if not we can look into whether pillow needs to be in the dev requirements now

@lwasser
Copy link

lwasser commented Apr 23, 2020

this also needs a change log entry!

@lwasser lwasser requested a review from nkorinek April 23, 2020 19:37
Copy link
Member

@nkorinek nkorinek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryla5068 just found a couple of small things that should be changed before this is merged, looks good!

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These import should be in pep8 order, matplotcheck being imported last

matplotcheck/base.py Outdated Show resolved Hide resolved
Comment on lines 948 to 950
except ValueError:
# xy_data and xy_expected do not have the same shape
raise AssertionError(message)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

raise ValueError(
                    "xy_data and xy_expected do not have the same shape"
                )

like the error raised above, right? Otherwise this except statement isn't very useful.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's go ahead and raise a valueError here!!

Co-Authored-By: Nathan Korinek <[email protected]>
@lwasser
Copy link

lwasser commented Apr 27, 2020

@ryla5068 let's try to wrap up this pr this week. nathan left a few comments and it looks like there is a linting issue. once those are addressed i can merge this

@marty-larocque
Copy link
Contributor Author

@lwasser This should be ready to be merged.

@@ -1026,7 +1033,7 @@ def assert_xlabel_ydata(
# Testing y-data
try:
np.testing.assert_array_max_ulp(
np.array(xy_data["y"]), np.array(xy_expected[ycol])
np.array(xy_data["y"]), np.array(xy_expected[ycol]), 5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious what the 5 is here that was added? @nkorinek when you look at this PR can you please see if it makes sense to you to have 5 there?

@lwasser
Copy link

lwasser commented May 4, 2020

ok @nkorinek the changes needed here are minor.

i have one question about a test that has the number 5 in it -- that was added in this pr and i want to ensure that should be there.

and then we just need to sync up the change log as the md and the rst version are now in this pr.
so please

  1. make sure the .rst file has the most recent changes - marty i think adds them at the bottom of the list so just make sure all unreleased stuff is captures and then
  2. delete the md file from this pr! then we can merge.

@nkorinek
Copy link
Member

nkorinek commented May 7, 2020

@lwasser ok, so the 5 was added into the assert_array_max_ulp() for the maxulp argument, which is described as:

maxulp: int, optional
    The maximum number of units in the last place that elements of a and b can differ. Default is 1

I don't see any reason for this number to be changed. I took out the argument all together and all of the tests still pass. I'll open up a new pr with those number removed and see if anything breaks, but I don't see a reason this was added in, unless I'm missing something.

@nkorinek nkorinek mentioned this pull request May 7, 2020
@nkorinek
Copy link
Member

nkorinek commented May 7, 2020

@lwasser this can be closed due to #273

@lwasser lwasser closed this May 8, 2020
@lwasser
Copy link

lwasser commented May 8, 2020

closed!. thanks @nkorinek !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants