Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_box2d_init(self):
"""Test construction and accessors of the object"""
min_corner = core.geodetic.Point2D(0, 1)
max_corner = core.geodetic.Point2D(2, 3)
box = core.geodetic.Box2D(min_corner, max_corner)
self.assertEqual(str(box), "((0, 1), (2, 3))")
self.assertEqual(box.min_corner.lon, 0)
self.assertEqual(box.min_corner.lat, 1)
self.assertEqual(box.max_corner.lon, 2)
self.assertEqual(box.max_corner.lat, 3)
self.assertTrue(box.covered_by(min_corner))
self.assertTrue(box.covered_by(max_corner))
self.assertTrue(box.covered_by(core.geodetic.Point2D(1, 2)))
self.assertFalse(box.covered_by(core.geodetic.Point2D(0, 0)))
flags = box.covered_by([1, 0], [2, 0])
self.assertTrue(np.all(flags == [1, 0]))
box.min_corner, box.max_corner = max_corner, min_corner
self.assertEqual(box.min_corner.lon, 2)
self.assertEqual(box.min_corner.lat, 3)
self.assertEqual(box.max_corner.lon, 0)
self.assertEqual(box.max_corner.lat, 1)
def test_box2d_init(self):
"""Test construction and accessors of the object"""
min_corner = core.geodetic.Point2D(0, 1)
max_corner = core.geodetic.Point2D(2, 3)
box = core.geodetic.Box2D(min_corner, max_corner)
self.assertEqual(str(box), "((0, 1), (2, 3))")
self.assertEqual(box.min_corner.lon, 0)
self.assertEqual(box.min_corner.lat, 1)
self.assertEqual(box.max_corner.lon, 2)
self.assertEqual(box.max_corner.lat, 3)
self.assertTrue(box.covered_by(min_corner))
self.assertTrue(box.covered_by(max_corner))
self.assertTrue(box.covered_by(core.geodetic.Point2D(1, 2)))
self.assertFalse(box.covered_by(core.geodetic.Point2D(0, 0)))
flags = box.covered_by([1, 0], [2, 0])
self.assertTrue(np.all(flags == [1, 0]))
box.min_corner, box.max_corner = max_corner, min_corner
self.assertEqual(box.min_corner.lon, 2)
self.assertEqual(box.min_corner.lat, 3)
self.assertEqual(box.max_corner.lon, 0)
self.assertEqual(box.max_corner.lat, 1)
def test_box2d_init(self):
"""Test construction and accessors of the object"""
min_corner = core.geodetic.Point2D(0, 1)
max_corner = core.geodetic.Point2D(2, 3)
box = core.geodetic.Box2D(min_corner, max_corner)
self.assertEqual(str(box), "((0, 1), (2, 3))")
self.assertEqual(box.min_corner.lon, 0)
self.assertEqual(box.min_corner.lat, 1)
self.assertEqual(box.max_corner.lon, 2)
self.assertEqual(box.max_corner.lat, 3)
self.assertTrue(box.covered_by(min_corner))
self.assertTrue(box.covered_by(max_corner))
self.assertTrue(box.covered_by(core.geodetic.Point2D(1, 2)))
self.assertFalse(box.covered_by(core.geodetic.Point2D(0, 0)))
flags = box.covered_by([1, 0], [2, 0])
self.assertTrue(np.all(flags == [1, 0]))
def test_point2d_init(self):
"""Test construction and accessors of the object"""
pt = core.geodetic.Point2D(12, 24)
self.assertEqual(pt.lon, 12)
self.assertEqual(pt.lat, 24)
self.assertEqual(str(pt), "(12, 24)")
pt.lon = 55
self.assertEqual(pt.lon, 55)
pt.lat = 33
self.assertEqual(pt.lat, 33)
def test_pickle(self):
"""Serialization tests"""
min_corner = core.geodetic.Point2D(0, 1)
max_corner = core.geodetic.Point2D(2, 3)
a = core.geodetic.Box2D(min_corner, max_corner)
b = pickle.loads(pickle.dumps(a))
self.assertEqual(a.min_corner.lon, b.min_corner.lon)
self.assertEqual(a.min_corner.lat, b.min_corner.lat)
self.assertEqual(a.max_corner.lon, b.max_corner.lon)
self.assertEqual(a.max_corner.lat, b.max_corner.lat)
def test_pickle(self):
"""Serialization tests"""
min_corner = core.geodetic.Point2D(0, 1)
max_corner = core.geodetic.Point2D(2, 3)
a = core.geodetic.Box2D(min_corner, max_corner)
b = pickle.loads(pickle.dumps(a))
self.assertEqual(a.min_corner.lon, b.min_corner.lon)
self.assertEqual(a.min_corner.lat, b.min_corner.lat)
self.assertEqual(a.max_corner.lon, b.max_corner.lon)
self.assertEqual(a.max_corner.lat, b.max_corner.lat)
def test_point2d_pickle(self):
"""Serialization tests"""
a = core.geodetic.Point2D(1, 2)
b = pickle.loads(pickle.dumps(a))
self.assertEqual(a.lon, b.lon)
self.assertEqual(a.lat, b.lat)
self.assertNotEqual(id(a), id(b))