Esempio n. 1
0
 def test_utf8(self):
     """
     Tests utf8 characters in attributes
     """
     filename = os.path.join(os.path.dirname(__file__), '..', 'importer-test-files', 'china_provinces.shp')
     layer = self.generic_import('china_provinces.shp')
     gi = OGRImport(filename)
     ds, insp = gi.open_target_datastore(gi.target_store)
     sql = str("select NAME_CH from %s where NAME_PY = 'An Zhou'" % (layer.name))
     res = ds.ExecuteSQL(sql)
     feat = res.GetFeature(0)
     self.assertEqual(feat.GetField('name_ch'), "安州")
 def test_utf8(self):
     """Tests utf8 characters in attributes
     """
     path = test_file('china_provinces.shp')
     layer = self.generic_import(path)
     ogr = OGRImport(path)
     datastore, _ = ogr.open_target_datastore(ogr.target_store)
     sql = ("select NAME_CH from {0} where NAME_PY = 'An Zhou'".format(
         layer.name))
     result = datastore.ExecuteSQL(sql)
     feature = result.GetFeature(0)
     self.assertEqual(feature.GetField('name_ch'), '安州')
Esempio n. 3
0
 def test_utf8(self):
     """
     Tests utf8 characters in attributes
     """
     filename = os.path.join(os.path.dirname(__file__), '..',
                             'importer-test-files', 'china_provinces.shp')
     layer = self.generic_import('china_provinces.shp')
     gi = OGRImport(filename)
     ds, insp = gi.open_target_datastore(gi.target_store)
     sql = str("select NAME_CH from %s where NAME_PY = 'An Zhou'" %
               (layer.name))
     res = ds.ExecuteSQL(sql)
     feat = res.GetFeature(0)
     self.assertEqual(feat.GetField('name_ch'), "安州")
 def test_utf8(self):
     """Tests utf8 characters in attributes
     """
     path = test_file('china_provinces.shp')
     layer = self.generic_import(path)
     ogr = OGRImport(path)
     datastore, _ = ogr.open_target_datastore(ogr.target_store)
     sql = (
         "select NAME_CH from {0} where NAME_PY = 'An Zhou'"
         .format(layer.name)
     )
     result = datastore.ExecuteSQL(sql)
     feature = result.GetFeature(0)
     self.assertEqual(feature.GetField('name_ch'), '安州')
        """
        Tests utf8 characters in attributes
        """
<<<<<<< HEAD
        filename = os.path.join(os.path.dirname(__file__), '..', 'importer-test-files', 'china_provinces.zip')
        layer = self.generic_import('china_provinces.zip')
=======
        filename = os.path.join(
            os.path.dirname(__file__),
            '..',
            'importer-test-files',
            'china_provinces.shp')
        layer = self.generic_import('china_provinces.shp')
>>>>>>> upstream/multiupload_cherrypick
        gi = OGRImport(filename)
        ds, insp = gi.open_target_datastore(gi.target_store)
        sql = str(
            "select NAME_CH from %s where NAME_PY = 'An Zhou'" %
            (layer.name))
        res = ds.ExecuteSQL(sql)
        feat = res.GetFeature(0)
        self.assertEqual(feat.GetField('name_ch'), "安州")

    def test_non_converted_date(self):
        """
        Test converting a field as date.
        """
        results = self.generic_import(
            'TM_WORLD_BORDERS_2005.zip', configuration_options=[{'index': 0,
                                                                 'start_date':
                                                                 'Year',