Skip to content

Commit 25a3199

Browse files
committed
Test default values. Pass in correct stop value.
1 parent 3f5641b commit 25a3199

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

test_shapefile.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -983,8 +983,9 @@ def test_iterRecords_start_stop():
983983
with shapefile.Reader("shapefiles/blockgroups") as sf:
984984
N = len(sf)
985985

986-
# Arbitrary selection of start values
987-
for start in [
986+
# Arbitrary selection of record indices
987+
# (there are 663 records in blockgroups.dbf).
988+
for i in [
988989
0,
989990
1,
990991
2,
@@ -1003,11 +1004,17 @@ def test_iterRecords_start_stop():
10031004
N - 2,
10041005
N - 1,
10051006
]:
1006-
for stop in range(start, len(sf)):
1007+
for record in sf.iterRecords(start=i):
1008+
assert record == sf.record(record.oid)
1009+
1010+
for record in sf.iterRecords(stop=i):
1011+
assert record == sf.record(record.oid)
1012+
1013+
for stop in range(i, len(sf)):
10071014
# test negative indexing from end, as well as
10081015
# positive values of stop, and its default
1009-
for stop_arg in (stop, stop - len(sf), None):
1010-
for record in sf.iterRecords(start=start, stop=stop):
1016+
for stop_arg in (stop, stop - len(sf)):
1017+
for record in sf.iterRecords(start=i, stop=stop_arg):
10111018
assert record == sf.record(record.oid)
10121019

10131020

0 commit comments

Comments
 (0)