Skip to content

Commit

Permalink
Replace "== True" with "is True" in test_shapefile.py
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesParrott committed Sep 18, 2024
1 parent 9163973 commit ffc7c46
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test_shapefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,15 @@ def test_reader_url():
with shapefile.Reader(url) as sf:
for recShape in sf.iterShapeRecords():
pass
assert sf.shp.closed == sf.shx.closed == sf.dbf.closed == True
assert sf.shp.closed == sf.shx.closed == sf.dbf.closed is True

# test without extension
url = "https://github.com/nvkelso/natural-earth-vector/blob/master/110m_cultural/ne_110m_admin_0_tiny_countries?raw=true"
with shapefile.Reader(url) as sf:
for recShape in sf.iterShapeRecords():
pass
assert len(sf) > 0
assert sf.shp.closed == sf.shx.closed == sf.dbf.closed == True
assert sf.shp.closed == sf.shx.closed == sf.dbf.closed is True

# test no files found
url = "https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/README.md"
Expand All @@ -281,7 +281,7 @@ def test_reader_url():
for recShape in sf.iterShapeRecords():
pass
assert len(sf) > 0
assert sf.shp.closed == sf.shx.closed == sf.dbf.closed == True
assert sf.shp.closed == sf.shx.closed == sf.dbf.closed is True


def test_reader_zip():
Expand All @@ -293,7 +293,7 @@ def test_reader_zip():
for recShape in sf.iterShapeRecords():
pass
assert len(sf) > 0
assert sf.shp.closed == sf.shx.closed == sf.dbf.closed == True
assert sf.shp.closed == sf.shx.closed == sf.dbf.closed is True

# test require specific path when reading multi-shapefile zipfile
with pytest.raises(shapefile.ShapefileException):
Expand All @@ -305,14 +305,14 @@ def test_reader_zip():
for recShape in sf.iterShapeRecords():
pass
assert len(sf) > 0
assert sf.shp.closed == sf.shx.closed == sf.dbf.closed == True
assert sf.shp.closed == sf.shx.closed == sf.dbf.closed is True

# test specifying the path when reading multi-shapefile zipfile (without extension)
with shapefile.Reader("shapefiles/blockgroups_multishapefile.zip/blockgroups2") as sf:
for recShape in sf.iterShapeRecords():
pass
assert len(sf) > 0
assert sf.shp.closed == sf.shx.closed == sf.dbf.closed == True
assert sf.shp.closed == sf.shx.closed == sf.dbf.closed is True

# test raising error when can't find shapefile inside zipfile
with pytest.raises(shapefile.ShapefileException):
Expand Down Expand Up @@ -1150,7 +1150,7 @@ def test_write_shp_only(tmpdir):
assert writer.shp and not writer.shx and not writer.dbf
assert writer.shpNum == 1
assert len(writer) == 1
assert writer.shp.closed == True
assert writer.shp.closed is True

# assert test.shp exists
assert os.path.exists(filename+'.shp')
Expand Down Expand Up @@ -1180,7 +1180,7 @@ def test_write_shp_shx_only(tmpdir):
assert writer.shp and writer.shx and not writer.dbf
assert writer.shpNum == 1
assert len(writer) == 1
assert writer.shp.closed == writer.shx.closed == True
assert writer.shp.closed == writer.shx.closed is True

# assert test.shp exists
assert os.path.exists(filename+'.shp')
Expand Down Expand Up @@ -1214,7 +1214,7 @@ def test_write_shp_dbf_only(tmpdir):
assert writer.shp and not writer.shx and writer.dbf
assert writer.shpNum == writer.recNum == 1
assert len(writer) == 1
assert writer.shp.closed == writer.dbf.closed == True
assert writer.shp.closed == writer.dbf.closed is True

# assert test.shp exists
assert os.path.exists(filename+'.shp')
Expand Down Expand Up @@ -1246,7 +1246,7 @@ def test_write_dbf_only(tmpdir):
assert not writer.shp and not writer.shx and writer.dbf
assert writer.recNum == 1
assert len(writer) == 1
assert writer.dbf.closed == True
assert writer.dbf.closed is True

# assert test.dbf exists
assert os.path.exists(filename+'.dbf')
Expand Down

0 comments on commit ffc7c46

Please sign in to comment.