Skip to content

SyntaxWarning for identity checks in test_shapefile #260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions test_shapefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,9 @@ def test_reader_shapefile_type():
is returned correctly.
"""
with shapefile.Reader("shapefiles/blockgroups") as sf:
assert sf.shapeType is 5 # 5 means Polygon
assert sf.shapeType is shapefile.POLYGON
assert sf.shapeTypeName is "POLYGON"
assert sf.shapeType == 5 # 5 means Polygon
assert sf.shapeType == shapefile.POLYGON
assert sf.shapeTypeName == "POLYGON"


def test_reader_shapefile_length():
Expand All @@ -429,9 +429,9 @@ def test_reader_shapefile_length():
def test_shape_metadata():
with shapefile.Reader("shapefiles/blockgroups") as sf:
shape = sf.shape(0)
assert shape.shapeType is 5 # Polygon
assert shape.shapeType is shapefile.POLYGON
assert sf.shapeTypeName is "POLYGON"
assert shape.shapeType == 5 # Polygon
assert shape.shapeType == shapefile.POLYGON
assert sf.shapeTypeName == "POLYGON"


def test_reader_fields():
Expand Down Expand Up @@ -497,9 +497,9 @@ def test_reader_shp_shx_only():
with shapefile.Reader(shp="shapefiles/blockgroups.shp", shx="shapefiles/blockgroups.shx") as sf:
assert len(sf) == 663
shape = sf.shape(3)
assert len(shape.points) is 173
assert len(shape.points) == 173



def test_reader_shp_dbf_only():
"""
Assert that specifying just the
Expand All @@ -509,7 +509,7 @@ def test_reader_shp_dbf_only():
with shapefile.Reader(shp="shapefiles/blockgroups.shp", dbf="shapefiles/blockgroups.dbf") as sf:
assert len(sf) == 663
shape = sf.shape(3)
assert len(shape.points) is 173
assert len(shape.points) == 173
record = sf.record(3)
assert record[1:3] == ['060750601001', 4715]

Expand All @@ -523,7 +523,7 @@ def test_reader_shp_only():
with shapefile.Reader(shp="shapefiles/blockgroups.shp") as sf:
assert len(sf) == 663
shape = sf.shape(3)
assert len(shape.points) is 173
assert len(shape.points) == 173


def test_reader_filelike_dbf_only():
Expand All @@ -547,7 +547,7 @@ def test_reader_filelike_shp_shx_only():
with shapefile.Reader(shp=open("shapefiles/blockgroups.shp", "rb"), shx=open("shapefiles/blockgroups.shx", "rb")) as sf:
assert len(sf) == 663
shape = sf.shape(3)
assert len(shape.points) is 173
assert len(shape.points) == 173


def test_reader_filelike_shp_dbf_only():
Expand All @@ -559,7 +559,7 @@ def test_reader_filelike_shp_dbf_only():
with shapefile.Reader(shp=open("shapefiles/blockgroups.shp", "rb"), dbf=open("shapefiles/blockgroups.dbf", "rb")) as sf:
assert len(sf) == 663
shape = sf.shape(3)
assert len(shape.points) is 173
assert len(shape.points) == 173
record = sf.record(3)
assert record[1:3] == ['060750601001', 4715]

Expand All @@ -573,7 +573,7 @@ def test_reader_filelike_shp_only():
with shapefile.Reader(shp=open("shapefiles/blockgroups.shp", "rb")) as sf:
assert len(sf) == 663
shape = sf.shape(3)
assert len(shape.points) is 173
assert len(shape.points) == 173


def test_reader_shapefile_delayed_load():
Expand Down Expand Up @@ -1101,7 +1101,7 @@ def test_shaperecord_shape():
shaperec = sf.shapeRecord(3)
shape = shaperec.shape
point = shape.points[0]
assert len(point) is 2
assert len(point) == 2


def test_shaperecord_record():
Expand Down