Skip to content

Some Timestamp tests fail #18095

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

Closed
Licht-T opened this issue Nov 3, 2017 · 3 comments
Closed

Some Timestamp tests fail #18095

Licht-T opened this issue Nov 3, 2017 · 3 comments

Comments

@Licht-T
Copy link
Contributor

Licht-T commented Nov 3, 2017

Code Sample, a copy-pastable example if possible

[pandas] python3 -m pytest pandas -k TestTimestamp                                                                                                  2:14:00master========================================================================== test session starts ==========================================================================
platform darwin -- Python 3.6.2, pytest-3.2.3, py-1.4.34, pluggy-0.4.0
metadata: {'Python': '3.6.2', 'Platform': 'Darwin-15.4.0-x86_64-i386-64bit', 'Packages': {'pytest': '3.2.3', 'py': '1.4.34', 'pluggy': '0.4.0'}, 'Plugins': {'metadata': '1.5.0', 'html': '1.15.2'}}
rootdir: /Users/rito/GitHub/pandas, inifile: setup.cfg
plugins: metadata-1.5.0, html-1.15.2
collected 15950 items / 2 skipped

pandas/tests/scalar/test_timestamp.py ................................................F......................

=============================================================================== FAILURES ================================================================================
_____________________________________________________________________ TestTimestamp.test_timestamp ______________________________________________________________________

self = <pandas.tests.scalar.test_timestamp.TestTimestamp object at 0x11b9c93c8>

    def test_timestamp(self):
        # GH#17329
        # tz-naive --> treat it as if it were UTC for purposes of timestamp()
        ts = Timestamp.now()
        uts = ts.replace(tzinfo=utc)
        assert ts.timestamp() == uts.timestamp()

        tsc = Timestamp('2014-10-11 11:00:01.12345678', tz='US/Central')
        utsc = tsc.tz_convert('UTC')
        # utsc is a different representation of the same time
        assert tsc.timestamp() == utsc.timestamp()

        if PY3:
            # should agree with datetime.timestamp method
            dt = ts.to_pydatetime()
>           assert dt.timestamp() == ts.timestamp()
E           AssertionError: assert 1509729329.177965 == 1509761729.177965
E            +  where 1509729329.177965 = <built-in method timestamp of datetime.datetime object at 0x11baa9120>()
E            +    where <built-in method timestamp of datetime.datetime object at 0x11baa9120> = datetime.datetime(2017, 11, 4, 2, 15, 29, 177965).timestamp
E            +  and   1509761729.177965 = <built-in method timestamp of Timestamp object at 0x11bb1be58>()
E            +    where <built-in method timestamp of Timestamp object at 0x11bb1be58> = Timestamp('2017-11-04 02:15:29.177965').timestamp

pandas/tests/scalar/test_timestamp.py:1110: AssertionError
======================================================================== 15879 tests deselected =========================================================================
=================================================== 1 failed, 70 passed, 2 skipped, 15879 deselected in 42.70 seconds ===================================================

Problem description

Seems that to_pydatetime does not treat the system locale.

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]
Python 3.6.2 (default, Jul 17 2017, 16:44:47)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import pandas as pd
pd.show_versions()

INSTALLED VERSIONS

commit: 27bbea7
python: 3.6.2.final.0
python-bits: 64
OS: Darwin
OS-release: 15.4.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: ja_JP.UTF-8
LOCALE: ja_JP.UTF-8

pandas: 0.22.0.dev0+49.g27bbea7ee
pytest: 3.2.3
pip: 9.0.1
setuptools: 36.6.0
Cython: 0.26
numpy: 1.13.3
scipy: 0.19.1
pyarrow: 0.7.1
xarray: None
IPython: 6.1.0
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: 0.4.0
matplotlib: 2.0.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999999999
sqlalchemy: 1.1.14
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@jschendel
Copy link
Member

Dupe of #18037

@Licht-T
Copy link
Contributor Author

Licht-T commented Nov 3, 2017

@jschendel Excuse me. I'll close this issue.

@Licht-T Licht-T closed this as completed Nov 3, 2017
@jschendel
Copy link
Member

No worries. Nearly did the same thing myself!

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

No branches or pull requests

2 participants