From ed378df313873ae0987b5b1b43032254f5ed633f Mon Sep 17 00:00:00 2001 From: Mahmoud Hashemi Date: Sun, 17 May 2015 22:34:49 -0700 Subject: [PATCH] 2.6 fixes --- tests/test_dictutils.py | 6 +++++- tests/test_formatutils.py | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/test_dictutils.py b/tests/test_dictutils.py index a0ca0ff..c7c7fb9 100644 --- a/tests/test_dictutils.py +++ b/tests/test_dictutils.py @@ -182,7 +182,11 @@ def test_poplast(): def test_reversed(): - from collections import OrderedDict + try: + from collections import OrderedDict + except: + # skip on python 2.6 + return for items in _ITEMSETS: omd = OMD(items) od = OrderedDict(items) diff --git a/tests/test_formatutils.py b/tests/test_formatutils.py index bf45f7f..2f2711b 100644 --- a/tests/test_formatutils.py +++ b/tests/test_formatutils.py @@ -28,8 +28,16 @@ _TEST_TMPLS = ["example 1: {hello}", "example 2: {hello:*10}", "example 3: {hello:*{width}}", "example 4: {hello!r:{fchar}{width}}, {width}, yes", - "example 5: {0}, {1:d}, {2:f}, {1}", - "example 6: {}, {}, {}, {1}"] + "example 5: {0}, {1:d}, {2:f}, {1}"] + +try: + from collections import OrderedDict +except ImportError: + pass # skip the non-2.6 compatible tests on 2.6 +else: + _TEST_TMPLS.append("example 6: {}, {}, {}, {1}") +finally: + del OrderedDict def test_get_fstr_args():