From 5b7009085ab211840ca5215833b7a1456744dce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Sat, 6 Jul 2013 11:17:30 +0200 Subject: [PATCH] add doctests for pairwise(iter) --- jsonpointer.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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