def test_constructor_same(self): # pass thru w and w/o copy index = RangeIndex(1, 5, 2) result = RangeIndex(index, copy=False) assert result.identical(index) result = RangeIndex(index, copy=True) tm.assert_index_equal(result, index, exact=True) result = RangeIndex(index) tm.assert_index_equal(result, index, exact=True) pytest.raises(TypeError, lambda: RangeIndex(index, dtype='float64'))
def test_constructor_same(self): # pass thru w and w/o copy index = RangeIndex(1, 5, 2) result = RangeIndex(index, copy=False) self.assertTrue(result.identical(index)) result = RangeIndex(index, copy=True) self.assertTrue(result.equals(index)) result = RangeIndex(index) self.assertTrue(result.equals(index)) self.assertRaises(TypeError, lambda: RangeIndex(index, dtype='float64'))
def test_constructor_same(self): # pass thru w and w/o copy index = RangeIndex(1, 5, 2) result = RangeIndex(index, copy=False) assert result.identical(index) result = RangeIndex(index, copy=True) tm.assert_index_equal(result, index, exact=True) result = RangeIndex(index) tm.assert_index_equal(result, index, exact=True) with pytest.raises( ValueError, match="Incorrect `dtype` passed: expected signed integer, received float64", ): RangeIndex(index, dtype="float64")