From 07af82432e40c51087ef5e5439f1c08d27121d59 Mon Sep 17 00:00:00 2001 From: Mahmoud Hashemi Date: Sun, 26 May 2013 22:46:54 -0700 Subject: [PATCH] add a couple tests for the SplayList --- boltons/listutils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/boltons/listutils.py b/boltons/listutils.py index 7903567..dade49d 100644 --- a/boltons/listutils.py +++ b/boltons/listutils.py @@ -281,6 +281,17 @@ class SplayList(list): # Tests +def test_splay(): + splay = SplayList(xrange(10)) + splay.swap(0, 9) + assert splay[0] == 9 + assert splay[-1] == 0 + + splay.shift(-2) + assert splay[0] == 8 + assert splay[-1] == 0 + assert len(splay) == 10 + def main(): import os