-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REF/TST: Add more pytest idiom to resample/test_datetime_index.py #24414
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #24414 +/- ##
==========================================
+ Coverage 92.3% 92.3% +<.01%
==========================================
Files 163 163
Lines 51943 51943
==========================================
+ Hits 47946 47947 +1
+ Misses 3997 3996 -1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #24414 +/- ##
==========================================
- Coverage 92.3% 92.29% -0.02%
==========================================
Files 163 163
Lines 51987 51969 -18
==========================================
- Hits 47989 47967 -22
- Misses 3998 4002 +4
Continue to review full report at Codecov.
|
Hello @simonjayhawkins! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on December 28, 2018 at 08:45 Hours UTC |
|
||
class TestDatetimeIndex(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do these actually to be class based at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for TDI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good. some suggestions.
|
||
|
||
def test_asfreq_bug(): | ||
import datetime as dt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you put the import at the top
funcs = ['add', 'mean', 'prod', 'ohlc', 'min', 'max', 'var'] | ||
for f in funcs: | ||
g._cython_agg_general(f) | ||
from pandas.compat import StringIO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you put the import at the top
index=dti, dtype='float64') | ||
r = df.groupby(b).agg(np.sum) | ||
# check all cython functions work | ||
funcs = ['add', 'mean', 'prod', 'min', 'max', 'var'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add to the list to parameterize (future PR is ok)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect this can be a fixture, as I see that list (or something similar to it) in several places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah we have this as a fixture already, just need to incorporate
4, 9, 4, 2 | ||
]}, index=date_range('2014-11-08', freq='6s', periods=4)) | ||
assert_frame_equal(result, expected) | ||
pytest.raises(Exception, ts.asfreq, 'B') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw ok to change these to the new format (if you want; we eventually want to fix all of these), e.g.
with pytest.raises(Exception):
ts.asfreq('B')
assert (resampled.loc['1/1/2000 6:00:00'] == exp).all() | ||
|
||
|
||
def test_downsample_non_unique(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on these extra long files, ok to put in some section separators and move functions around
somthing like
# ----
# ohlc
# ----
these make sense when we remove the class based testing, not super necessary but nice to have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you address this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's still lots to do for this module... only a handful of tests were split or parametrised in this PR. i would prefer to move functions and add section separators as a parallel activity with the splitting and parametrizing of the remaining tests. are you OK with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, let's do after this one
@@ -79,7 +79,8 @@ def f(df): | |||
tm.assert_index_equal(result.index, df.index) | |||
|
|||
|
|||
@pytest.mark.filterwarnings("ignore:\\nPanel:FutureWarning") | |||
@pytest.mark.filterwarnings("ignore::FutureWarning") | |||
# @pytest.mark.filterwarnings("ignore:\\nPanel:FutureWarning") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple of comments. ideally like to organize this and / or split to multiple files; there is a lot going on here
|
||
rng = date_range('1/1/2000', '12/31/2000') | ||
ts = Series(np.random.randn(len(rng)), index=rng) | ||
def test_resample_categorical_data_with_timedeltaindex(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to tdi tests
thanks! |
git diff upstream/master -u -- "*.py" | flake8 --diff