def test01_3d(self):
        # 3D models for the rest of the tests will be populated in here.
        # For each 3D data set create model (and 2D version if necessary),
        # retrieve, and assert geometry is in 3D and contains the expected
        # 3D values.
        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.assertTrue(city.point.hasz)
            self.assertEqual(z, city.point.z)

        # Interstate (2D / 3D and Geographic/Projected variants)
        for name, line, exp_z in interstate_data:
            line_3d = GEOSGeometry(line, srid=4269)
            # Using `hex` attribute because it omits 3D.
            line_2d = GEOSGeometry(line_3d.hex, srid=4269)

            # Creating a geographic and projected version of the
            # interstate in both 2D and 3D.
            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)

            # Retrieving and making sure it's 3D and has expected
            # Z values -- shouldn't change because of coordinate system.
            interstate = Interstate3D.objects.get(name=name)
            interstate_proj = InterstateProj3D.objects.get(name=name)
            for i in [interstate, interstate_proj]:
                self.assertTrue(i.line.hasz)
                self.assertEqual(exp_z, tuple(i.line.z))

        # Creating 3D Polygon.
        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.assertTrue(p3d.poly.hasz)
        self.assertEqual(bbox3d, p3d.poly)
Test the creation of 3D models.
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/contrib/gis/tests/geo3d/tests.py/Geo3DTest.test01_3d