Skip to content

TST: failing test at tseries/tests/test_base.py TestDatetimeIndexOps test_nat #14345

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
MattRijk opened this issue Oct 4, 2016 · 1 comment
Closed
Labels
Testing pandas testing functions or related to the test suite
Milestone

Comments

@MattRijk
Copy link
Contributor

MattRijk commented Oct 4, 2016

A small, complete example of the issue

======================================================================
FAIL: test_nat (pandas.tseries.tests.test_base.TestDatetimeIndexOps)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/matt/pandas-mattrijk/pandas/tseries/tests/test_base.py", line 878, in test_nat
    tm.assert_numpy_array_equal(idx._nan_idxs, np.array([], dtype=np.int64))
  File "/home/matt/pandas-mattrijk/pandas/util/testing.py", line 1084, in assert_numpy_array_equal
    assert_attr_equal('dtype', left, right, obj=obj)
  File "/home/matt/pandas-mattrijk/pandas/util/testing.py", line 878, in assert_attr_equal
    left_attr, right_attr)
  File "/home/matt/pandas-mattrijk/pandas/util/testing.py", line 1019, in raise_assert_detail
    raise AssertionError(msg)
AssertionError: numpy array are different

Attribute "dtype" are different
[left]:  int32
[right]: int64

----------------------------------------------------------------------
Ran 92 tests in 3.580s

FAILED (failures=1)


Process finished with exit code 0

Expected Output

failing test

idx = pd.DatetimeIndex(['2011-01-01', '2011-01-02'], tz=tz)
tm.assert_numpy_array_equal(idx._nan_idxs, np.array([], dtype=np.int64))

idx = pd.DatetimeIndex(['2011-01-01', 'NaT'], tz=tz)
tm.assert_numpy_array_equal(idx._nan_idxs, np.array([1], dtype=np.int64))

test passes

tm.assert_numpy_array_equal(idx._nan_idxs, np.array([], dtype=np.int32))

In Ipython on 32bit the values look fine.

In [3]: idx = pd.DatetimeIndex(['2016-01-01', 'NaT'], tz=None)

In [4]: idx.dtype
Out[4]: dtype('<M8[ns]')

In [5]: idx._nan_idxs
Out[5]: array([], dtype=int64)

In [6]: arry = np.array([], dtype=np.int64)

In [7]: arry
Out[7]: array([], dtype=int64)

In [8]: import pandas.util.testing as tm

In [9]: tm.assert_numpy_array_equal(idx._nan_idxs, arry))
Out[9]: True

This fixes it but I think theres more going on.

import platform
if platform.architecture()[0] == '32bit':
tm.assert_numpy_array_equal(idx._nan_idxs, np.array([], dtype=np.int32))
else:
tm.assert_numpy_array_equal(idx._nan_idxs, np.array([], dtype=np.int64))

Output of pd.show_versions()

## INSTALLED VERSIONS

commit: None
python: 2.7.12.final.0
python-bits: 32
OS: Linux
OS-release: 3.13.0-92-generic
machine: i686
processor: i686
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None

pandas: 0.19.0
nose: 1.3.7
pip: 8.1.2
setuptools: 27.2.0
Cython: 0.24.1
numpy: 1.11.1
scipy: 0.18.1
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: 1.4.6
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: 1.1.0
tables: 3.2.3.1
numexpr: 2.6.1
matplotlib: 1.5.3
openpyxl: 2.4.0
xlrd: 1.0.0
xlwt: 1.1.2
xlsxwriter: 0.9.3
lxml: 3.6.4
bs4: 4.3.2
html5lib: 0.999
httplib2: None
apiclient: None
sqlalchemy: 1.0.13
pymysql: 0.7.6.None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: 0.2.1

@chris-b1
Copy link
Contributor

chris-b1 commented Oct 4, 2016

Thanks for the report, I think the test just needs written with an expectation of np.intp rather than np.int64. We don't run CI on 32 bit Linux, so some of these kind of things sneak in.

@chris-b1 chris-b1 added Testing pandas testing functions or related to the test suite Difficulty Novice labels Oct 4, 2016
@chris-b1 chris-b1 added this to the 0.19.1 milestone Oct 4, 2016
@jreback jreback closed this as completed in 58542e8 Oct 6, 2016
yarikoptic added a commit to neurodebian/pandas that referenced this issue Oct 13, 2016
* commit 'v0.19.0-14-ga40e185': (37 commits)
  BUG: Bug in localizing an ambiguous timezone when a boolean is passed
  Convert readthedocs links for their .org -> .io migration for hosted projects (pandas-dev#14406)
  DOC: formatting in basics.rst
  BLD/CI: cython cache pxd files (pandas-dev#14363)
  BUG: set_levels set illegal levels. (pandas-dev#14236)
  DOC: add whitespace to v0.19.1 bug fix section
  change impl details slightly for pandas-dev#14292
  BUG: Fix concat key name
  DOC: add 0.19.1 whatsnew file (pandas-dev#14366)
  DOC: to_csv warns regarding quoting behaviour for floats pandas-dev#14195 (pandas-dev#14228)
  DOC: fix formatting issue with msgpack table
  TST: pandas-dev#14345 fixes TestDatetimeIndexOps test_nat AssertionErrors on 32-bit
  docs: Remove old warning from dsintro.rst (pandas-dev#14365)
  DOC: minor v0.19.0 whatsnew corrections
  RLS: v0.19.0
  DOC: update release notes
  DOC: Latest fixes for whatsnew file
  to_latex encoding follows the documentation (py2 ascii, py3 utf8) (pandas-dev#14329)
  DOC: fix some sphinx build issues (pandas-dev#14332)
  TST: fix period tests for numpy 1.9.3 (GH14183) (pandas-dev#14331)
  ...
tworec pushed a commit to RTBHOUSE/pandas that referenced this issue Oct 21, 2016
…rors on 32-bit

closes pandas-dev#14345

Author: mattrijk <[email protected]>

Closes pandas-dev#14347 from MattRijk/issue#14345 and squashes the following commits:

73ad3d7 [mattrijk] line 2710 formatting update for whitespace
ea4f151 [mattrijk] second formatting update for whitespace
262492f [mattrijk] TST: pandas-dev#14345 fixes TestDatetimeIndexOps test_nat AssertionErors
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants