'Testing Point objects.'

def test_points(self):

    prev = fromstr(u'POINT(0    0)')
    for p in self.geometries.points:
        pnt = fromstr(p.wkt)
        self.assertEqual(pnt.geom_type, u'Point')
        self.assertEqual(pnt.geom_typeid, 0)
        self.assertEqual(p.x, pnt.x)
        self.assertEqual(p.y, pnt.y)
        self.assertEqual(True, (pnt == fromstr(p.wkt)))
        self.assertEqual(False, (pnt == prev))
        self.assertAlmostEqual(p.x, pnt.tuple[0], 9)
        self.assertAlmostEqual(p.y, pnt.tuple[1], 9)
        if hasattr(p, u'z'):
            self.assertEqual(True, pnt.hasz)
            self.assertEqual(p.z, pnt.z)
            self.assertEqual(p.z, pnt.tuple[2], 9)
            tup_args = (p.x, p.y, p.z)
            set_tup1 = (2.71, 3.14, 5.23)
            set_tup2 = (5.23, 2.71, 3.14)
        else:
            self.assertEqual(False, pnt.hasz)
            self.assertEqual(None, pnt.z)
            tup_args = (p.x, p.y)
            set_tup1 = (2.71, 3.14)
            set_tup2 = (3.14, 2.71)
        self.assertEqual(p.centroid, pnt.centroid.tuple)
        pnt2 = Point(tup_args)
        pnt3 = Point(*tup_args)
        self.assertEqual(True, (pnt == pnt2))
        self.assertEqual(True, (pnt == pnt3))
        pnt.y = 3.14
        pnt.x = 2.71
        self.assertEqual(3.14, pnt.y)
        self.assertEqual(2.71, pnt.x)
        pnt.tuple = set_tup1
        self.assertEqual(set_tup1, pnt.tuple)
        pnt.coords = set_tup2
        self.assertEqual(set_tup2, pnt.coords)
        prev = pnt
