diff options
author | Stefan Kögl <stefan@skoegl.net> | 2013-07-06 11:17:30 +0200 |
---|---|---|
committer | Stefan Kögl <stefan@skoegl.net> | 2013-07-06 11:18:13 +0200 |
commit | 5b7009085ab211840ca5215833b7a1456744dce2 (patch) | |
tree | 8ad9d6c68f3e055542fcc7812c9289ec52a1e59e | |
parent | a3982e34ca8849796ab09d9ce49b86eb208da4cc (diff) | |
download | python-json-pointer-5b7009085ab211840ca5215833b7a1456744dce2.tar.gz |
add doctests for pairwise(iter)
-rw-r--r-- | jsonpointer.py | 12 |
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 |