Skip to content

Commit 94ef7dd

Browse files
committed
Reduce number of test indices by ~half, and don't iterate entire range between them
1 parent 4132c62 commit 94ef7dd

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

test_shapefile.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,7 @@ def test_record_oid():
987987
assert shaperec.record.oid == i
988988

989989

990+
@pytest.mark.slow
990991
def test_iterRecords_start_stop():
991992
"""
992993
Assert that Reader.iterRecords(start, stop)
@@ -999,36 +1000,31 @@ def test_iterRecords_start_stop():
9991000

10001001
# Arbitrary selection of record indices
10011002
# (there are 663 records in blockgroups.dbf).
1002-
for i in [
1003+
indices = [
10031004
0,
10041005
1,
10051006
2,
1006-
3,
10071007
5,
10081008
11,
1009-
17,
1010-
33,
1011-
51,
1012-
103,
1013-
170,
1014-
234,
1015-
435,
1016-
543,
1009+
41,
1010+
310,
1011+
513,
10171012
N - 3,
1018-
N - 2,
10191013
N - 1,
1020-
]:
1021-
for record in sf.iterRecords(start=i):
1014+
]
1015+
for i, index in enumerate(indices):
1016+
for record in sf.iterRecords(start=index):
10221017
assert record == sf.record(record.oid)
10231018

1024-
for record in sf.iterRecords(stop=i):
1019+
for record in sf.iterRecords(stop=index):
10251020
assert record == sf.record(record.oid)
10261021

1027-
for stop in range(i, len(sf)):
1022+
for j in range(i + 1, len(indices)):
1023+
stop = indices[j]
10281024
# test negative indexing from end, as well as
10291025
# positive values of stop, and its default
1030-
for stop_arg in (stop, stop - len(sf)):
1031-
for record in sf.iterRecords(start=i, stop=stop_arg):
1026+
for stop_arg in (stop, stop - N):
1027+
for record in sf.iterRecords(start=index, stop=stop_arg):
10321028
assert record == sf.record(record.oid)
10331029

10341030

0 commit comments

Comments
 (0)