示例#1
0
 def test_roundtrip_valid_05(self):
     # test the conversion to shapefile and back for a valid file NRML 0.5
     ssm = os.path.join(os.path.dirname(__file__),
                        "data", "sample_source_model_05.xml")
     to_shapefile(os.path.join(self.OUTDIR, 'smc'), ssm, True)
     shpfiles = [os.path.join(self.OUTDIR, f)
                 for f in os.listdir(self.OUTDIR)]
     from_shapefile(os.path.join(self.OUTDIR, 'smc'), shpfiles, True)
示例#2
0
 def test_roundtrip_valid(self):
     # test the conversion to shapefile and back for a valid file
     ssm = os.path.join(os.path.dirname(__file__),
                        "data", "sample_source_model.xml")
     to_shapefile(os.path.join(self.OUTDIR, 'smc'), ssm, True)
     shpfiles = [os.path.join(self.OUTDIR, f)
                 for f in os.listdir(self.OUTDIR)]
     from_shapefile(os.path.join(self.OUTDIR, 'smc'), shpfiles, True)
示例#3
0
    def test_roundtrip_invalid(self):
        # test the conversion to shapefile and back for an invalid file
        smc = os.path.join(os.path.dirname(__file__),
                           "data", "source_model_complete.xml")
        to_shapefile(os.path.join(self.OUTDIR, 'smc'), smc, False)
        shpfiles = [os.path.join(self.OUTDIR, f)
                    for f in os.listdir(self.OUTDIR)]
        from_shapefile(os.path.join(self.OUTDIR, 'smc'), shpfiles, False)

        # test invalid file
        with self.assertRaises(Exception) as ctx:
            to_shapefile(os.path.join(self.OUTDIR, 'smc'), smc, True)
        self.assertIn('Edges points are not in the right order',
                      str(ctx.exception))
示例#4
0
    def test_roundtrip_invalid(self):
        # test the conversion to shapefile and back for an invalid file
        smc = os.path.join(os.path.dirname(__file__),
                           "data", "source_model_complete.xml")
        to_shapefile(os.path.join(self.OUTDIR, 'smc'), smc, False)
        shpfiles = [os.path.join(self.OUTDIR, f)
                    for f in os.listdir(self.OUTDIR)]
        from_shapefile(os.path.join(self.OUTDIR, 'smc'), shpfiles, False)

        # test invalid file
        with self.assertRaises(Exception) as ctx:
            to_shapefile(os.path.join(self.OUTDIR, 'smc'), smc, True)
        self.assertIn('Edges points are not in the right order',
                      str(ctx.exception))