'Test the creation of 3D models.'

def test01_3d(self):

    for (name, pnt_data) in city_data:
        (x, y, z) = pnt_data
        pnt = Point(x, y, z, srid=4326)
        City3D.objects.create(name=name, point=pnt)
        city = City3D.objects.get(name=name)
        self.failUnless(city.point.hasz)
        self.assertEqual(z, city.point.z)
    for (name, line, exp_z) in interstate_data:
        line_3d = GEOSGeometry(line, srid=4269)
        line_2d = GEOSGeometry(line_3d.hex, srid=4269)
        Interstate3D.objects.create(name=name, line=line_3d)
        InterstateProj3D.objects.create(name=name, line=line_3d)
        Interstate2D.objects.create(name=name, line=line_2d)
        InterstateProj2D.objects.create(name=name, line=line_2d)
        interstate = Interstate3D.objects.get(name=name)
        interstate_proj = InterstateProj3D.objects.get(name=name)
        for i in [interstate, interstate_proj]:
            self.failUnless(i.line.hasz)
            self.assertEqual(exp_z, tuple(i.line.z))
    (bbox2d, bbox3d) = gen_bbox()
    Polygon2D.objects.create(name='2D    BBox', poly=bbox2d)
    Polygon3D.objects.create(name='3D    BBox', poly=bbox3d)
    p3d = Polygon3D.objects.get(name='3D    BBox')
    self.failUnless(p3d.poly.hasz)
    self.assertEqual(bbox3d, p3d.poly)
