Skip to content

Conversation

@Garrett-R
Copy link
Contributor

closes #9281

The last test of both test_now and test_today was passing for anyone with a timezone
of UTC-5 or greater (but failed, for example, in US/Pacific). The test was not
testing what the original author meant it to (which is that the times are very close
together) so I added abs(.) around the Timedeltas and also fixed the errant test.

…estamp The last tests of both `test_now` and `test_today` were passing for anyone with a timezone of UTC-5 or greater (but failed, for example, for people in US/Pacific). The test was not testing what the original author meant it to (which is that the times are very close together) so I added abs(.) around the Timedeltas and also fixed the errant test.
@jreback jreback added the Testing pandas testing functions or related to the test suite label Jan 19, 2015
@jreback jreback added this to the 0.16.0 milestone Jan 19, 2015
jreback added a commit that referenced this pull request Jan 19, 2015
BUG: Fixes #9281: fixes to tseries.tests.test_tslib.TestTimestamp
@jreback jreback merged commit 02cbd9e into pandas-dev:master Jan 19, 2015
@jreback
Copy link
Contributor

jreback commented Jan 19, 2015

thanks!

@rockg
Copy link
Contributor

rockg commented Jan 19, 2015

I don't think abs() is necessary here given the order that the times are created so the difference will always be positive. Nevertheless, thanks for fixing.

@Garrett-R
Copy link
Contributor Author

@rockg, yeah, I wasn't too sure about the abs, but I was thinking it makes the tests more likely to catch some problematic code that someone writes in the future. For example, take

self.assertTrue(abs(ts_from_method_tz - ts_from_string_tz) < delta) 

If someone ends up rewriting Timestamp.now(tz='US/Eastern') and it erronesously causes ts_from_string_tz to have a value corresponding to the user's local time instead of US/Eastern, then because of abs, the test will fail not only for users with a timezone less than UTC-5, but rather for everyone.

@Garrett-R Garrett-R deleted the fix_GH9281 branch January 19, 2015 19:32
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

3 participants