diff --git a/doc/source/whatsnew/v0.22.0.txt b/doc/source/whatsnew/v0.22.0.txt index 5c64b0a55c09b..459cf40e9e7d5 100644 --- a/doc/source/whatsnew/v0.22.0.txt +++ b/doc/source/whatsnew/v0.22.0.txt @@ -89,6 +89,7 @@ Bug Fixes - Bug in ``pd.read_msgpack()`` with a non existent file is passed in Python 2 (:issue:`15296`) - Bug in ``DataFrame.groupby`` where key as tuple in a ``MultiIndex`` were interpreted as a list of keys (:issue:`17979`) +- .timestamp() unittests fail on python3 (:issue:`18037`) Conversion ^^^^^^^^^^ diff --git a/pandas/tests/scalar/test_timestamp.py b/pandas/tests/scalar/test_timestamp.py index 4cd9a2fadeb32..bb046348be53c 100644 --- a/pandas/tests/scalar/test_timestamp.py +++ b/pandas/tests/scalar/test_timestamp.py @@ -1106,8 +1106,8 @@ def test_timestamp(self): if PY3: # should agree with datetime.timestamp method - dt = ts.to_pydatetime() - assert dt.timestamp() == ts.timestamp() + dt = uts.to_pydatetime() + assert dt.timestamp() == uts.timestamp() class TestTimestampNsOperations(object): diff --git a/pandas/tests/tseries/test_timezones.py b/pandas/tests/tseries/test_timezones.py index ddcf1bb7d8b7b..e755d9b654eb9 100644 --- a/pandas/tests/tseries/test_timezones.py +++ b/pandas/tests/tseries/test_timezones.py @@ -1283,8 +1283,10 @@ def test_replace_tzinfo(self): assert result_dt == result_pd assert result_dt == result_pd.to_pydatetime() - result_dt = dt.replace(tzinfo=tzinfo).replace(tzinfo=None) - result_pd = Timestamp(dt).replace(tzinfo=tzinfo).replace(tzinfo=None) + result_dt = (dt.replace(tzinfo=tzinfo) + .replace(tzinfo=pytz.timezone('UTC'))) + result_pd = (Timestamp(dt).replace(tzinfo=tzinfo) + .replace(tzinfo=pytz.timezone('UTC'))) if hasattr(result_dt, 'timestamp'): # New method in Py 3.3 assert result_dt.timestamp() == result_pd.timestamp()