BF: skip equivalence test for itemsize and nbytes if "values" ndarray view of type...
authorYaroslav Halchenko <debian@onerussian.com>
Thu, 12 Jan 2017 18:10:11 +0000 (18:10 +0000)
committerYaroslav Halchenko <debian@onerussian.com>
Thu, 12 Jan 2017 18:10:11 +0000 (18:10 +0000)
Gbp-Pq: Name changeset_848ce49a9f006eadfd169d2fc545a5d15b616f7c.diff

pandas/tests/indexes/common.py

index 1b373baf9b3c18613ce8d6f662b97aef7796af17..a3205fac9b5e5e3f4cd04fcc6ecc1bfe10699bbb 100644 (file)
@@ -127,6 +127,12 @@ class Base(object):
 
         values = idx.values
         for prop in self._compat_props:
+            # skip equivalency check if converted type is object, as happens
+            # for PeriodIndex, since then object (address) would be 4 bytes
+            # on 32bit platforms and equivalence to int64 of original
+            # date time is just accidental
+            if prop in ('itemsize', 'nbytes') and values.dtype.name == 'object':
+                continue
             self.assertEqual(getattr(idx, prop), getattr(values, prop))
 
         # test for validity