#NEWLINE# def test_constructor( self ) : #NEWLINE# #INDENT# index = RangeIndex ( 5 ) #NEWLINE# expected = np . arange ( 5 , dtype = np . int64 ) #NEWLINE# self . assertIsInstance ( index , RangeIndex ) #NEWLINE# self . assertEqual ( index . _start , 0 ) #NEWLINE# self . assertEqual ( index . _stop , 5 ) #NEWLINE# self . assertEqual ( index . _step , 1 ) #NEWLINE# self . assertEqual ( index . name , None ) #NEWLINE# tm . assert_index_equal ( Index ( self ) , index ) #NEWLINE# index = RangeIndex ( 1 , 5 ) #NEWLINE# expected = np . arange ( 1 , 5 , dtype = np . int64 ) #NEWLINE# self . assertIsInstance ( index , RangeIndex ) #NEWLINE# self . assertEqual ( index . _start , 1 ) #NEWLINE# tm . assert_index_equal ( Index ( expected ) , index ) #NEWLINE# index = RangeIndex ( 1 , 5 , 2 ) #NEWLINE# expected = np . arange ( 1 , 5 , 2 , dtype = np . int64 ) #NEWLINE# self . assertIsInstance ( index , RangeIndex ) #NEWLINE# self . assertEqual ( index . _step , 2 ) #NEWLINE# tm . assert_index_equal ( Index ( expected ) , index ) #NEWLINE# index = RangeIndex ( ) #NEWLINE# expected = np . empty ( 0 , dtype = np . int64 ) #NEWLINE# self . assertIsInstance ( index , RangeIndex ) #NEWLINE# self . assertEqual ( index . _start , 0 ) #NEWLINE# self . assertEqual ( index . _stop , 0 ) #NEWLINE# self . assertEqual ( index . _step , 1 ) #NEWLINE# tm . assert_index_equal ( Index ( expected ) , index ) #NEWLINE# index = RangeIndex ( name = 'Foo' ) #NEWLINE# self . assertIsInstance ( index , RangeIndex ) #NEWLINE# self . assertEqual ( index . name , 'Foo' ) #NEWLINE# self . assertRaises ( TypeError , ( lambda : Index ( 0 , 1000 ) ) ) #NEWLINE# for i in [ Index ( [ 'a' , 'b' ] ) , Series ( [ 'a' , 'b' ] ) , np . array ( [ 'a' , 'b' ] ) , [ ] , 'foo' , datetime ( 2000 , 1 , 1 , 0 , 0 ) , np . arange ( 0 , 10 ) ] : #NEWLINE# #INDENT# self . assertRaises ( TypeError , ( lambda : RangeIndex ( i ) ) )