summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2013-07-06 11:17:30 +0200
committerStefan Kögl <stefan@skoegl.net>2013-07-06 11:18:13 +0200
commit5b7009085ab211840ca5215833b7a1456744dce2 (patch)
tree8ad9d6c68f3e055542fcc7812c9289ec52a1e59e
parenta3982e34ca8849796ab09d9ce49b86eb208da4cc (diff)
downloadpython-json-pointer-5b7009085ab211840ca5215833b7a1456744dce2.tar.gz
add doctests for pairwise(iter)
-rw-r--r--jsonpointer.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/jsonpointer.py b/jsonpointer.py
index 05ccd92..b6d1430 100644
--- a/jsonpointer.py
+++ b/jsonpointer.py
@@ -223,7 +223,17 @@ class JsonPointer(object):
def pairwise(iterable):
- "s -> (s0,s1), (s1,s2), (s2, s3), ..."
+ """ s -> (s0,s1), (s1,s2), (s2, s3), ...
+
+ >>> list(pairwise([]))
+ []
+
+ >>> list(pairwise([1]))
+ []
+
+ >>> list(pairwise([1, 2, 3, 4]))
+ [(1, 2), (2, 3), (3, 4)]
+ """
a, b = tee(iterable)
for _ in b:
break