code: def test_hasnans_isnans(self, index_flat):
      # GH#11343, added tests for hasnans / isnans
      index = index_flat
  
      # cases in indices doesn't include NaN
      idx = index.copy(deep=True)
      expected = np.array([False] * len(idx), dtype=bool)
      tm.assert_numpy_array_equal(idx._isnan, expected)
      assert idx.hasnans is False
  
      idx = index.copy(deep=True)
      values = idx._values
  
      if len(index) == 0:
          return
      elif is_integer_dtype(index.dtype):
          return
      elif index.dtype == bool:
          # values[1] = np.nan below casts to True!
          return
  
      values[1] = np.nan
  
      idx = type(index)(values)
  
      expected = np.array([False] * len(idx), dtype=bool)
      expected[1] = True
      tm.assert_numpy_array_equal(idx._isnan, expected)
      assert idx.hasnans is True
  
imports: from copy import copy, deepcopy
  import re
  import numpy
  import pytest
  from pandas.compat import IS64
  from pandas.compat.numpy import np_version_gte1p25
  from pandas.core.dtypes.common import is_integer_dtype, is_numeric_dtype
  import pandas
  from pandas import CategoricalIndex, MultiIndex, PeriodIndex, RangeIndex
  import pandas._testing
label_desc: Use image node_id 19 for calling the TestCommon obj's underlying member method code with example usage: obj.test_hasnans_isnans(index_flat) without return types