Coverage for tests/test_pickles.py : 52%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# # Developed for the LSST Data Management System. # This product includes software developed by the LSST Project # (https://www.lsst.org). # See the COPYRIGHT file at the top-level directory of this distribution # for details of code ownership. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. #
Tests for pickles of some afw types """
"""A test case for pickles"""
raise NotImplementedError( "Need to inherit and create the 'data' element.")
del self.data
"""Assert that the pickled data is the same as the original
Subclasses should override this method if the particular data doesn't support the == operator. """ self.assertEqual(new, self.data)
"""Test round-trip pickle""" pickled = pickle.dumps(self.data) newData = pickle.loads(pickled) self.assertPickled(newData)
self.data = 1.0*lsst.geom.degrees
x, y = 1.0, 1.0 self.data = lsst.geom.Point2D(x, y)
x, y = 1, 1 self.data = lsst.geom.Point2I(x, y)
x, y, z = 1.0, 1.0, 1.0 self.data = lsst.geom.Point3D(x, y, z)
x, y, z = 1, 1, 1 self.data = lsst.geom.Point3I(x, y, z)
x, y = 1.0, 1.0 self.data = lsst.geom.Extent2D(x, y)
x, y, z = 1, 1, 1 self.data = lsst.geom.Extent3D(x, y, z)
x, y = 1, 1 self.data = lsst.geom.Extent2I(x, y)
x, y, z = 1, 1, 1 self.data = lsst.geom.Extent3I(x, y, z)
p, e = lsst.geom.Point2D(1.0, 1.0), lsst.geom.Extent2D(0.5, 0.5) self.data = lsst.geom.Box2D(p, e)
p, e = lsst.geom.Point2I(1, 2), lsst.geom.Extent2I(1, 1) self.data = lsst.geom.Box2I(p, e)
scale = 2.2 linear = lsst.geom.LinearTransform().makeScaling(scale) dx, dy = 1.1, 3.3 trans = lsst.geom.Extent2D(dx, dy) self.data = lsst.geom.AffineTransform(linear, trans)
self.assertListEqual(new.getMatrix().flatten().tolist(), self.data.getMatrix().flatten().tolist())
scale = 2.0 self.data = lsst.geom.LinearTransform().makeScaling(scale)
self.assertListEqual(new.getMatrix().flatten().tolist(), self.data.getMatrix().flatten().tolist())
lsst.utils.tests.init()
lsst.utils.tests.init() unittest.main() |