TST: Fix assertNotIsInstance msg by sinhrks · Pull Request #13091 · pandas-dev/pandas (original) (raw)

so lots of things fail on windows. probably all because of comparisons on int32/int64.

e.g. np.array([1,2,3]) constructs as int32 on windows. So if you are comparing to something just force the constrution with np.array([1,2,3],dtype=np.int64). If you ARE expecting platform int, then use dtype=np.intp

btw you can setup appveyor (just need to login it free), to at least see build failures. its slow but can give you a feel for errors.

======================================================================
FAIL: pandas.tests.test_tseries.test_outer_join_indexer
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Miniconda2\envs\pandas3.5\lib\site-packages\nose\case.py", line 198, in runTest
    self.test(*self.arg)
  File "C:\Users\conda\Documents\pandas3.5\pandas\tests\test_tseries.py", line 133, in test_outer_join_indexer
    assert_almost_equal(bres, bexp)
  File "C:\Users\conda\Documents\pandas3.5\pandas\util\testing.py", line 131, in assert_almost_equal
    return _testing.assert_almost_equal(left, right, **kwargs)
  File "pandas\src\testing.pyx", line 58, in pandas._testing.assert_almost_equal (pandas\src\testing.c:3479)
    cpdef assert_almost_equal(a, b, bint check_less_precise=False, check_dtype=True,
  File "pandas\src\testing.pyx", line 131, in pandas._testing.assert_almost_equal (pandas\src\testing.c:2184)
    assert_attr_equal('dtype', a, b, obj=obj)
  File "C:\Users\conda\Documents\pandas3.5\pandas\util\testing.py", line 820, in assert_attr_equal
    left_attr, right_attr)
  File "C:\Users\conda\Documents\pandas3.5\pandas\util\testing.py", line 931, in raise_assert_detail
    raise AssertionError(msg)
AssertionError: numpy array are different

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

----------------------------------------------------------------------
Ran 10142 tests in 405.745s

FAILED (SKIP=182, failures=52)
-> assert_almost_equal(ares, aexp)
(Pdb) l
104         index_exp = np.array([3, 5], dtype=np.int64)
105         assert_almost_equal(index, index_exp)
106
107         aexp = np.array([2, 4])
108         bexp = np.array([1, 2])
109  ->     assert_almost_equal(ares, aexp)
110         assert_almost_equal(bres, bexp)
111
112         a = np.array([5], dtype=np.int64)
113         b = np.array([5], dtype=np.int64)
114
(Pdb) p ares
array([2, 4], dtype=int64)
(Pdb) p bexp
array([1, 2])
(Pdb) p bexp.dtype
dtype('int32')
(Pdb) l 100
 95         assert (np.array_equal(ridx, exp_ridx))
 96
 97
 98     def test_inner_join_indexer():
 99         a = np.array([1, 2, 3, 4, 5], dtype=np.int64)
100         b = np.array([0, 3, 5, 7, 9], dtype=np.int64)
101
102         index, ares, bres = algos.inner_join_indexer_int64(a, b)
103
104         index_exp = np.array([3, 5], dtype=np.int64)
105         assert_almost_equal(index, index_exp)
(Pdb) l
106
107         aexp = np.array([2, 4])
108         bexp = np.array([1, 2])
109  ->     assert_almost_equal(ares, aexp)
110         assert_almost_equal(bres, bexp)
111
112         a = np.array([5], dtype=np.int64)
113         b = np.array([5], dtype=np.int64)
114
115         index, ares, bres = algos.inner_join_indexer_int64(a, b)
116         assert_almost_equal(index, [5])
(Pdb) p bexp
array([1, 2])
(Pdb) p ares
array([2, 4], dtype=int64)
(Pdb)