mirror of
https://github.com/wassname/geopandas.git
synced 2026-09-11 12:10:59 +08:00
TST: Import test utilities with fully qualified name
This commit is contained in:
@@ -3,13 +3,13 @@ from __future__ import absolute_import
|
||||
import fiona
|
||||
|
||||
from geopandas import GeoDataFrame, read_postgis, read_file
|
||||
import tests.util
|
||||
from .util import PANDAS_NEW_SQL_API, unittest
|
||||
from geopandas.tests.util import download_nybb, connect, create_db, \
|
||||
PANDAS_NEW_SQL_API, unittest, validate_boro_df
|
||||
|
||||
|
||||
class TestIO(unittest.TestCase):
|
||||
def setUp(self):
|
||||
nybb_filename = tests.util.download_nybb()
|
||||
nybb_filename = download_nybb()
|
||||
path = '/nybb_14a_av/nybb.shp'
|
||||
vfs = 'zip://' + nybb_filename
|
||||
self.df = read_file(path, vfs=vfs)
|
||||
@@ -17,8 +17,8 @@ class TestIO(unittest.TestCase):
|
||||
self.crs = f.crs
|
||||
|
||||
def test_read_postgis_default(self):
|
||||
con = tests.util.connect('test_geopandas')
|
||||
if con is None or not tests.util.create_db(self.df):
|
||||
con = connect('test_geopandas')
|
||||
if con is None or not create_db(self.df):
|
||||
raise unittest.case.SkipTest()
|
||||
|
||||
try:
|
||||
@@ -30,11 +30,11 @@ class TestIO(unittest.TestCase):
|
||||
con = con.connect()
|
||||
con.close()
|
||||
|
||||
tests.util.validate_boro_df(self, df)
|
||||
validate_boro_df(self, df)
|
||||
|
||||
def test_read_postgis_custom_geom_col(self):
|
||||
con = tests.util.connect('test_geopandas')
|
||||
if con is None or not tests.util.create_db(self.df):
|
||||
con = connect('test_geopandas')
|
||||
if con is None or not create_db(self.df):
|
||||
raise unittest.case.SkipTest()
|
||||
|
||||
try:
|
||||
@@ -49,9 +49,9 @@ class TestIO(unittest.TestCase):
|
||||
con = con.connect()
|
||||
con.close()
|
||||
|
||||
tests.util.validate_boro_df(self, df)
|
||||
validate_boro_df(self, df)
|
||||
|
||||
def test_read_file(self):
|
||||
df = self.df.rename(columns=lambda x: x.lower())
|
||||
tests.util.validate_boro_df(self, df)
|
||||
validate_boro_df(self, df)
|
||||
self.assert_(df.crs == self.crs)
|
||||
|
||||
@@ -11,7 +11,7 @@ from geopandas import GeoSeries
|
||||
from geopandas.tools import geocode, reverse_geocode
|
||||
from geopandas.tools.geocoding import _prepare_geocode_result
|
||||
|
||||
from .util import unittest, mock, assert_geoseries_equal
|
||||
from geopandas.tests.util import unittest, mock, assert_geoseries_equal
|
||||
|
||||
|
||||
def _skip_if_no_geopy():
|
||||
|
||||
@@ -12,8 +12,8 @@ from shapely.geometry import Point, Polygon
|
||||
|
||||
import fiona
|
||||
from geopandas import GeoDataFrame, read_file, GeoSeries
|
||||
from .util import unittest, download_nybb, assert_geoseries_equal, connect, \
|
||||
create_db, validate_boro_df, PANDAS_NEW_SQL_API
|
||||
from geopandas.tests.util import unittest, download_nybb, assert_geoseries_equal, \
|
||||
connect, create_db, validate_boro_df, PANDAS_NEW_SQL_API
|
||||
|
||||
|
||||
class TestDataFrame(unittest.TestCase):
|
||||
|
||||
@@ -14,7 +14,7 @@ from shapely.ops import unary_union
|
||||
|
||||
from geopandas import GeoSeries, GeoDataFrame
|
||||
from geopandas.base import GeoPandasBase
|
||||
from .util import (
|
||||
from geopandas.tests.util import (
|
||||
unittest, geom_equals, geom_almost_equals, assert_geoseries_equal
|
||||
)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ from shapely.geometry import (Polygon, Point, LineString,
|
||||
MultiPoint, MultiLineString, MultiPolygon)
|
||||
from shapely.geometry.base import BaseGeometry
|
||||
from geopandas import GeoSeries
|
||||
from .util import unittest, geom_equals, geom_almost_equals
|
||||
from geopandas.tests.util import unittest, geom_equals
|
||||
|
||||
|
||||
class TestSeries(unittest.TestCase):
|
||||
|
||||
@@ -4,7 +4,7 @@ import shutil
|
||||
from shapely.geometry import Point
|
||||
from geopandas import GeoDataFrame, read_file
|
||||
from geopandas.tools import overlay
|
||||
from .util import unittest, download_nybb
|
||||
from geopandas.tests.util import unittest, download_nybb
|
||||
|
||||
|
||||
class TestDataFrame(unittest.TestCase):
|
||||
|
||||
@@ -7,7 +7,7 @@ from shapely.geometry import (Polygon, Point, LineString,
|
||||
MultiPoint, MultiLineString, MultiPolygon)
|
||||
from shapely.geometry.base import BaseGeometry
|
||||
from geopandas import GeoSeries, GeoDataFrame, base, read_file
|
||||
from .util import unittest, geom_equals, geom_almost_equals
|
||||
from geopandas.tests.util import unittest
|
||||
|
||||
|
||||
@unittest.skipIf(not base.HAS_SINDEX, 'Rtree absent, skipping')
|
||||
|
||||
@@ -5,7 +5,7 @@ from shapely.geometry import Point
|
||||
from pandas import Series, DataFrame
|
||||
|
||||
from geopandas import GeoSeries, GeoDataFrame
|
||||
from .util import unittest
|
||||
from geopandas.tests.util import unittest
|
||||
|
||||
OLD_PANDAS = issubclass(Series, np.ndarray)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import numpy as np
|
||||
from shapely.geometry import Point
|
||||
|
||||
from geopandas import GeoDataFrame, read_file, base
|
||||
from .util import unittest, download_nybb
|
||||
from geopandas.tests.util import unittest, download_nybb
|
||||
from geopandas.tools import sjoin
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import absolute_import
|
||||
from shapely.geometry import Point, MultiPoint, LineString
|
||||
from geopandas import GeoSeries
|
||||
from geopandas.tools import collect
|
||||
from .util import unittest
|
||||
from geopandas.tests.util import unittest
|
||||
|
||||
class TestTools(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
||||
Reference in New Issue
Block a user