'Regression test for https://aeon.stsci.edu/ssb/trac/pyfits/ticket/143
This is like test_section_data_square but uses a file containing scaled
image data, to test that sections can work correctly with scaled data.'

def test_section_data_scaled(self):

    hdul = fits.open(self.data('scale.fits'))
    d = hdul[0]
    dat = hdul[0].data
    assert (d.section[:, :] == dat[:, :]).all()
    assert (d.section[0, :] == dat[0, :]).all()
    assert (d.section[1, :] == dat[1, :]).all()
    assert (d.section[:, 0] == dat[:, 0]).all()
    assert (d.section[:, 1] == dat[:, 1]).all()
    assert (d.section[(0, 0)] == dat[(0, 0)]).all()
    assert (d.section[(0, 1)] == dat[(0, 1)]).all()
    assert (d.section[(1, 0)] == dat[(1, 0)]).all()
    assert (d.section[(1, 1)] == dat[(1, 1)]).all()
    assert (d.section[0:1, 0:1] == dat[0:1, 0:1]).all()
    assert (d.section[0:2, 0:1] == dat[0:2, 0:1]).all()
    assert (d.section[0:1, 0:2] == dat[0:1, 0:2]).all()
    assert (d.section[0:2, 0:2] == dat[0:2, 0:2]).all()
    hdul = fits.open(self.data('scale.fits'))
    d = hdul[0]
    assert (d.section[:, :] == dat[:, :]).all()
    assert (d.section[0, :] == dat[0, :]).all()
    assert (d.section[1, :] == dat[1, :]).all()
    assert (d.section[:, 0] == dat[:, 0]).all()
    assert (d.section[:, 1] == dat[:, 1]).all()
    assert (d.section[(0, 0)] == dat[(0, 0)]).all()
    assert (d.section[(0, 1)] == dat[(0, 1)]).all()
    assert (d.section[(1, 0)] == dat[(1, 0)]).all()
    assert (d.section[(1, 1)] == dat[(1, 1)]).all()
    assert (d.section[0:1, 0:1] == dat[0:1, 0:1]).all()
    assert (d.section[0:2, 0:1] == dat[0:2, 0:1]).all()
    assert (d.section[0:1, 0:2] == dat[0:1, 0:2]).all()
    assert (d.section[0:2, 0:2] == dat[0:2, 0:2]).all()
    assert (not d._data_loaded)
