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

isolate scalar Timestamp tests from date_range tests #17957

Merged
merged 7 commits into from
Oct 27, 2017

Conversation

jbrockmendel
Copy link
Member

Discussed in #17697

  • closes #xxxx
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@gfyoung gfyoung added the Timezones Timezone data dtype label Oct 23, 2017

def test_date_range_timestamp_equiv(self):
rng = date_range('20090415', '20090519', tz='US/Eastern')
stamp = rng[0]
Copy link
Member

@gfyoung gfyoung Oct 23, 2017

Choose a reason for hiding this comment

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

Given that you use this construct several times across tests (i.e. rng = date_range(...)[0]), you might want to consider making that a separate method.

Copy link
Member Author

Choose a reason for hiding this comment

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

Given the large number of irons in the fire at the moment, would you be OK with these comments going into #17652 and being addressed in a follow-up?

Copy link
Member

Choose a reason for hiding this comment

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

@jbrockmendel : I would prefer to make a push to refactor now, as this is a reorganization PR after all. Save it in the end as a last commit to this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

I would prefer to make a push to refactor now, as this is a reorganization PR after all. Save it in the end as a last commit to this PR.

Alright, let's wrap this thing up! Thanks for taking the time to review.

Given that you use this construct several times across tests (i.e. rng = date_range(...)[0]), you might want to consider making that a separate method.

Seems like replacing a 1-line function call with a 1-line method call doesn't really gain anything, no?

assert ts == stamp

def test_date_range_timestamp_equiv_from_datetime_instance(self):
# This test refers to TestTimestampOps.test_addition_subtraction_types
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if comments like these are necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will remove.


pytest.raises(ValueError, frequencies.to_offset, '100foo')

pytest.raises(ValueError, frequencies.to_offset, ('', ''))
Copy link
Member

Choose a reason for hiding this comment

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

What are the error messages when you make these method calls? I would consider using tm.assert_raises_regex so that we can check the error message if necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

No idea. This is just cut/paste from test_timestamp.

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha. Run these lines of code and see what error messages you get. Then we can see whether we should check the message in the test.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, pushing updated...

@codecov
Copy link

codecov bot commented Oct 23, 2017

Codecov Report

Merging #17957 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17957      +/-   ##
==========================================
- Coverage   91.23%   91.22%   -0.02%     
==========================================
  Files         163      163              
  Lines       50113    50113              
==========================================
- Hits        45723    45714       -9     
- Misses       4390     4399       +9
Flag Coverage Δ
#multiple 89.03% <ø> (ø) ⬆️
#single 40.31% <ø> (-0.06%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.75% <0%> (-0.1%) ⬇️

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 e1dabf3...1f0f982. Read the comment docs.

@jbrockmendel
Copy link
Member Author

Closes #17958.

@jreback
Copy link
Contributor

jreback commented Oct 23, 2017

these changes are fine. if those 2 non-tests (that were not prefixed correctly) are not easy fixes, you can simply xfail them (and then open an issue so we don't lose track of the fix).

# see gh-8254
assert False
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the issue here? I guess this test wasn't turned on before.

Copy link
Member Author

Choose a reason for hiding this comment

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

Woops, yah. That was an earlier check that these were not getting hit. Changing now.

@@ -592,7 +593,8 @@ def to_datetime_depr(self):
result = ts.to_datetime()
assert result == expected

def to_pydatetime_nonzero_nano(self):
def test_to_pydatetime_nonzero_nano(self):
assert False
Copy link
Contributor

Choose a reason for hiding this comment

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

same?

@jreback jreback added the Testing pandas testing functions or related to the test suite label Oct 23, 2017
@jreback jreback added this to the 0.22.0 milestone Oct 25, 2017
@jreback
Copy link
Contributor

jreback commented Oct 25, 2017

looks fine. will merge after we release.

@jreback jreback merged commit f39f62e into pandas-dev:master Oct 27, 2017
@jreback
Copy link
Contributor

jreback commented Oct 27, 2017

thanks!

@jbrockmendel jbrockmendel deleted the tslibs-testing branch October 30, 2017 16:25
peterpanmj pushed a commit to peterpanmj/pandas that referenced this pull request Oct 31, 2017
No-Stream pushed a commit to No-Stream/pandas that referenced this pull request Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants