Skip to content

Commit

Permalink
Fix flake8 ambiguous variable name errors in test_functional
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmayo committed Mar 14, 2020
1 parent e05a676 commit 2cadea8
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,33 +288,33 @@ def test_WKT(self):
# With PostGIS 2.0:
# DataError: (DataError) Geometry SRID (0) does not match column SRID
# (4326)
l = Lake('LINESTRING(0 0,1 1)')
session.add(l)
lake = Lake('LINESTRING(0 0,1 1)')
session.add(lake)

with pytest.raises((DataError, IntegrityError)):
session.flush()

def test_WKTElement(self):
l = Lake(WKTElement('LINESTRING(0 0,1 1)', srid=4326))
session.add(l)
lake = Lake(WKTElement('LINESTRING(0 0,1 1)', srid=4326))
session.add(lake)
session.flush()
session.expire(l)
assert isinstance(l.geom, WKBElement)
wkt = session.execute(l.geom.ST_AsText()).scalar()
session.expire(lake)
assert isinstance(lake.geom, WKBElement)
wkt = session.execute(lake.geom.ST_AsText()).scalar()
assert wkt == 'LINESTRING(0 0,1 1)'
srid = session.execute(l.geom.ST_SRID()).scalar()
srid = session.execute(lake.geom.ST_SRID()).scalar()
assert srid == 4326

def test_WKBElement(self):
shape = LineString([[0, 0], [1, 1]])
l = Lake(from_shape(shape, srid=4326))
session.add(l)
lake = Lake(from_shape(shape, srid=4326))
session.add(lake)
session.flush()
session.expire(l)
assert isinstance(l.geom, WKBElement)
wkt = session.execute(l.geom.ST_AsText()).scalar()
session.expire(lake)
assert isinstance(lake.geom, WKBElement)
wkt = session.execute(lake.geom.ST_AsText()).scalar()
assert wkt == 'LINESTRING(0 0,1 1)'
srid = session.execute(l.geom.ST_SRID()).scalar()
srid = session.execute(lake.geom.ST_SRID()).scalar()
assert srid == 4326

@postgis2_required
Expand Down Expand Up @@ -357,10 +357,10 @@ def teardown(self):
metadata.drop_all()

def _create_one_lake(self):
l = Lake(WKTElement('LINESTRING(0 0,1 1)', srid=4326))
session.add(l)
lake = Lake(WKTElement('LINESTRING(0 0,1 1)', srid=4326))
session.add(lake)
session.flush()
return l.id
return lake.id

def test_pickle_unpickle(self):
import pickle
Expand Down Expand Up @@ -390,10 +390,10 @@ def teardown(self):
metadata.drop_all()

def _create_one_lake(self):
l = Lake(WKTElement('LINESTRING(0 0,1 1)', srid=4326))
session.add(l)
lake = Lake(WKTElement('LINESTRING(0 0,1 1)', srid=4326))
session.add(lake)
session.flush()
return l.id
return lake.id

def _create_one_poi(self):
p = Poi('POINT(5 45)')
Expand Down

0 comments on commit 2cadea8

Please sign in to comment.