Skip to content

Commit 04258b0

Browse files
committed
resolve comments Tom
1 parent ad51b2a commit 04258b0

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

owslib/catalogue/csw2.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -859,12 +859,13 @@ def __init__(self, record):
859859
self.spatial = None
860860
if val is not None:
861861
val = util.testXMLValue(val)
862-
if len(val.split(',')) == 4:
862+
bbox_tokens = val.split(',')
863+
if len(bbox_tokens) == 4:
863864
self.bbox = ows.BoundingBox(None, namespaces['ows'])
864-
self.bbox.minx = val.split(',')[0]
865-
self.bbox.miny = val.split(',')[1]
866-
self.bbox.maxx = val.split(',')[2]
867-
self.bbox.maxy = val.split(',')[3]
865+
self.bbox.minx = bbox_tokens[0]
866+
self.bbox.miny = bbox_tokens[1]
867+
self.bbox.maxx = bbox_tokens[2]
868+
self.bbox.maxy = bbox_tokens[3]
868869
else:
869870
self.spatial = val
870871

owslib/catalogue/csw3.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -761,12 +761,13 @@ def __init__(self, record):
761761
self.spatial = None
762762
if val is not None:
763763
val = util.testXMLValue(val)
764-
if len(val.split(',')) == 4:
764+
bbox_tokens = val.split(',')
765+
if len(bbox_tokens) == 4:
765766
self.bbox = ows.BoundingBox(None, namespaces['ows'])
766-
self.bbox.minx = val.split(',')[0]
767-
self.bbox.miny = val.split(',')[1]
768-
self.bbox.maxx = val.split(',')[2]
769-
self.bbox.maxy = val.split(',')[3]
767+
self.bbox.minx = bbox_tokens[0]
768+
self.bbox.miny = bbox_tokens[1]
769+
self.bbox.maxx = bbox_tokens[2]
770+
self.bbox.maxy = bbox_tokens[3]
770771
else:
771772
self.spatial = val
772773

tests/test_csw_parsing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def get_md_resource(file_path):
2626
"""
2727
namespaces = Namespaces().get_namespaces(keys=('dc', 'dct', 'ows', 'rdf', 'gml', 'csw'))
2828

29-
with io.open(file_path, mode='r', encoding='utf-8') as f:
29+
with open(file_path, mode='r', encoding='utf-8') as f:
3030
data = f.read().encode('utf-8')
3131
mdelem = etree.fromstring(data)
3232

@@ -64,6 +64,6 @@ def test_spatial_parsing():
6464
md_resource = get_md_resource('tests/resources/9250AA67-F3AC-6C12-0CB9-0662231AA181_dc2.xml')
6565
md = CswRecord(md_resource)
6666

67-
assert type(md) is CswRecord
67+
assert isinstance(md, CswRecord)
6868
assert md.title == "Feasibility of Using the Two-Source Energy Balance Model (TSEB) with Sentinel-2 and Sentinel-3 Images to Analyze the Spatio-Temporal Variability of Vine Water Status in a Vineyard"
6969
assert md.bbox.minx == '-180'

0 commit comments

Comments
 (0)