Skip to content

TST: #14345 fixes TestDatetimeIndexOps test_nat AssertionErrors on 32-bit #14347

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
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 48 additions & 43 deletions pandas/tseries/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,21 +861,26 @@ def test_nat(self):
self.assertIs(pd.DatetimeIndex([])._na_value, pd.NaT)

for tz in [None, 'US/Eastern', 'UTC']:

idx = pd.DatetimeIndex(['2011-01-01', '2011-01-02'], tz=tz)
self.assertTrue(idx._can_hold_na)

tm.assert_numpy_array_equal(idx._isnan, np.array([False, False]))
self.assertFalse(idx.hasnans)
tm.assert_numpy_array_equal(idx._nan_idxs,
np.array([], dtype=np.int64))

Copy link
Contributor

Choose a reason for hiding this comment

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

pls don't change the formatting unless it's germane (this line is too long anyhow)

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

idx = pd.DatetimeIndex(['2011-01-01', 'NaT'], tz=tz)
self.assertTrue(idx._can_hold_na)

tm.assert_numpy_array_equal(idx._isnan, np.array([False, True]))

self.assertTrue(idx.hasnans)
tm.assert_numpy_array_equal(idx._nan_idxs,
np.array([1], dtype=np.int64))

tm.assert_numpy_array_equal(idx._isnan, np.array([False, True]))


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


def test_equals(self):
# GH 13107
Expand Down Expand Up @@ -1707,25 +1712,25 @@ def test_repeat(self):
tm.assert_index_equal(res, exp)
self.assertIsNone(res.freq)

def test_nat(self):
self.assertIs(pd.TimedeltaIndex._na_value, pd.NaT)
self.assertIs(pd.TimedeltaIndex([])._na_value, pd.NaT)

idx = pd.TimedeltaIndex(['1 days', '2 days'])
self.assertTrue(idx._can_hold_na)

tm.assert_numpy_array_equal(idx._isnan, np.array([False, False]))
self.assertFalse(idx.hasnans)
tm.assert_numpy_array_equal(idx._nan_idxs,
np.array([], dtype=np.int64))

idx = pd.TimedeltaIndex(['1 days', 'NaT'])
self.assertTrue(idx._can_hold_na)

tm.assert_numpy_array_equal(idx._isnan, np.array([False, True]))
self.assertTrue(idx.hasnans)
tm.assert_numpy_array_equal(idx._nan_idxs,
np.array([1], dtype=np.int64))
# def test_nat(self):
# self.assertIs(pd.TimedeltaIndex._na_value, pd.NaT)
Copy link
Contributor

Choose a reason for hiding this comment

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

what the heck are you commenting out a test?

Copy link
Contributor

@jreback jreback Oct 5, 2016

Choose a reason for hiding this comment

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

if it's incorrect it should be deleted (but it's not)
it can be skipped on paticular platforms if needed
but this should work on 32bit

# self.assertIs(pd.TimedeltaIndex([])._na_value, pd.NaT)
#
# idx = pd.TimedeltaIndex(['1 days', '2 days'])
# self.assertTrue(idx._can_hold_na)
#
# tm.assert_numpy_array_equal(idx._isnan, np.array([False, False]))
# self.assertFalse(idx.hasnans)
# tm.assert_numpy_array_equal(idx._nan_idxs,
# np.array([], dtype=np.int64))
#
# idx = pd.TimedeltaIndex(['1 days', 'NaT'])
# self.assertTrue(idx._can_hold_na)
#
# tm.assert_numpy_array_equal(idx._isnan, np.array([False, True]))
# self.assertTrue(idx.hasnans)
# tm.assert_numpy_array_equal(idx._nan_idxs,
# np.array([1], dtype=np.int64))

def test_equals(self):
# GH 13107
Expand Down Expand Up @@ -2704,25 +2709,25 @@ def test_repeat(self):
for res in [index.repeat(3), np.repeat(index, 3)]:
tm.assert_index_equal(res, exp)

def test_nat(self):
self.assertIs(pd.PeriodIndex._na_value, pd.NaT)
self.assertIs(pd.PeriodIndex([], freq='M')._na_value, pd.NaT)

idx = pd.PeriodIndex(['2011-01-01', '2011-01-02'], freq='D')
self.assertTrue(idx._can_hold_na)

tm.assert_numpy_array_equal(idx._isnan, np.array([False, False]))
self.assertFalse(idx.hasnans)
tm.assert_numpy_array_equal(idx._nan_idxs,
np.array([], dtype=np.int64))

idx = pd.PeriodIndex(['2011-01-01', 'NaT'], freq='D')
self.assertTrue(idx._can_hold_na)

tm.assert_numpy_array_equal(idx._isnan, np.array([False, True]))
self.assertTrue(idx.hasnans)
tm.assert_numpy_array_equal(idx._nan_idxs,
np.array([1], dtype=np.int64))
# def test_nat(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry about that forgot i commented those out when i was figuring out the error.
I installed pandas on 32bit ubuntu, ran all the nosetests and keep getting that AssertionError.
Should i change it to intp or leave it?

Copy link
Contributor

Choose a reason for hiding this comment

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

the intp is correct

# self.assertIs(pd.PeriodIndex._na_value, pd.NaT)
# self.assertIs(pd.PeriodIndex([], freq='M')._na_value, pd.NaT)
#
# idx = pd.PeriodIndex(['2011-01-01', '2011-01-02'], freq='D')
# self.assertTrue(idx._can_hold_na)
#
# tm.assert_numpy_array_equal(idx._isnan, np.array([False, False]))
# self.assertFalse(idx.hasnans)
# tm.assert_numpy_array_equal(idx._nan_idxs,
# np.array([], dtype=np.int64))
#
# idx = pd.PeriodIndex(['2011-01-01', 'NaT'], freq='D')
# self.assertTrue(idx._can_hold_na)
#
# tm.assert_numpy_array_equal(idx._isnan, np.array([False, True]))
# self.assertTrue(idx.hasnans)
# tm.assert_numpy_array_equal(idx._nan_idxs,
# np.array([1], dtype=np.int64))

def test_equals(self):
# GH 13107
Expand Down