Skip to content

Commit

Permalink
Dict views only became reversible in 3.8+
Browse files Browse the repository at this point in the history
  • Loading branch information
cjrh committed Apr 5, 2020
1 parent c5d6051 commit b801475
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import pytest
from enumerate_reversible import enumerate as new_enumerate

Expand All @@ -13,13 +14,6 @@
tuple(),
(1, ),
(1, 2, 3),
# Views
dict().keys(),
dict().values(),
dict().items(),
dict(a=1, b=2, c=2).keys(),
dict(a=1, b=2, c=2).values(),
dict(a=1, b=2, c=2).items(),
# Ranges
range(0),
range(3),
Expand All @@ -42,6 +36,19 @@
memoryview(b'abc'),
]


if sys.version_info >= (3, 8):
sequences.extend([
# Views
dict().keys(),
dict().values(),
dict().items(),
dict(a=1, b=2, c=2).keys(),
dict(a=1, b=2, c=2).values(),
dict(a=1, b=2, c=2).items(),
])


forward_values = [
(
s, start, list(enumerate(s, start=start))
Expand Down

0 comments on commit b801475

Please sign in to comment.