#NEWLINE# def test_constructor_spindex_dtype( self ) : #NEWLINE# #INDENT# arr = SparseArray ( data = [ 1 , 2 ] , sparse_index = IntIndex ( 4 , [ 1 , 2 ] ) ) #NEWLINE# tm . assert_sp_array_equal ( arr , SparseArray ( [ np . nan , 1 , 2 , np . nan ] ) ) #NEWLINE# self . assertEqual ( arr . dtype , np . float64 ) #NEWLINE# self . assertTrue ( np . isnan ( arr . fill_value ) ) #NEWLINE# arr = SparseArray ( data = [ 0 , 1 , 2 , 3 ] , sparse_index = IntIndex ( 4 , [ 0 , 1 , 2 , 3 ] ) , dtype = np . int64 ) #NEWLINE# exp = SparseArray ( [ 0 , 1 , 2 , 3 ] , dtype = np . int64 ) #NEWLINE# tm . assert_sp_array_equal ( arr , exp ) #NEWLINE# self . assertEqual ( arr . dtype , np . int64 ) #NEWLINE# self . assertTrue ( np . isnan ( arr . fill_value ) ) #NEWLINE# arr = SparseArray ( data = [ 1 , 2 ] , sparse_index = IntIndex ( 4 , [ 1 , 2 ] ) , fill_value = 0 , dtype = np . int64 ) #NEWLINE# exp = SparseArray ( [ 0 , 1 , 2 , 0 ] , fill_value = 0 , dtype = np . int64 ) #NEWLINE# tm . assert_sp_array_equal ( arr , exp ) #NEWLINE# self . assertEqual ( arr . dtype , np . int64 ) #NEWLINE# self . assertEqual ( arr . fill_value , 0 ) #NEWLINE# arr = SparseArray ( data = [ 0 , 1 , 2 , 3 ] , sparse_index = IntIndex ( 4 , [ 0 , 1 , 2 , 3 ] ) , dtype = None ) #NEWLINE# exp = SparseArray ( [ 0 , 1 , 2 , 3 ] , dtype = None ) #NEWLINE# tm . assert_sp_array_equal ( arr , exp ) #NEWLINE# self . assertEqual ( arr . dtype , np . int64 ) #NEWLINE# self . assertTrue ( np . isnan ( arr . fill_value ) ) #NEWLINE# arr = SparseArray ( data = 1 , sparse_index = IntIndex ( 1 , [ 0 ] ) , dtype = None ) #NEWLINE# exp = SparseArray ( [ 1 ] , dtype = None ) #NEWLINE# tm . assert_sp_array_equal ( arr , exp ) #NEWLINE# self . assertEqual ( arr . dtype , np . int64 ) #NEWLINE# self . assertTrue ( np . isnan ( arr . fill_value ) ) #NEWLINE# arr = SparseArray ( data = [ 1 , 2 ] , sparse_index = IntIndex ( 4 , [ 1 , 2 ] ) , fill_value = 0 , dtype = None ) #NEWLINE# exp = SparseArray ( [ 0 , 1 , 2 , 0 ] , fill_value = 0 , dtype = None ) #NEWLINE# tm . assert_sp_array_equal ( arr , exp ) #NEWLINE# self . assertEqual ( arr . dtype , np . int64 ) #NEWLINE# self . assertEqual ( arr . fill_value , 0 )