summaryrefslogtreecommitdiff
path: root/prettytable_test.py
diff options
context:
space:
mode:
authorluke@maurits.id.au <luke@maurits.id.au@0f58610c-415a-11de-9c03-5d6cfad8e937>2013-05-14 05:34:33 +0000
committerluke@maurits.id.au <luke@maurits.id.au@0f58610c-415a-11de-9c03-5d6cfad8e937>2013-05-14 05:34:33 +0000
commit9f5146fc80de918f0c4d78e42fdda91fec1be3c6 (patch)
treecbbcf2fad0f0ea4ff52de4fa609fae4fd8321ba4 /prettytable_test.py
parent817d1cad150d816f9815b3682725ce95d4747951 (diff)
downloadpython-prettytable-9f5146fc80de918f0c4d78e42fdda91fec1be3c6.tar.gz
Fixed sorting/slicing so that they happen in the more obvious order.
Added oldsortslice option to revert to old behaviour for backward compatibility. git-svn-id: http://prettytable.googlecode.com/svn/trunk@128 0f58610c-415a-11de-9c03-5d6cfad8e937
Diffstat (limited to 'prettytable_test.py')
-rw-r--r--prettytable_test.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/prettytable_test.py b/prettytable_test.py
index 66a821b..4efdf33 100644
--- a/prettytable_test.py
+++ b/prettytable_test.py
@@ -322,6 +322,18 @@ class SortingTests(CityDataTest):
+-----------+------+------------+-----------------+
""".strip()
+ def testSortSlice(self):
+ """Make sure sorting and slicing interact in the expected way"""
+ x = PrettyTable(["Foo"])
+ for i in range(20, 0, -1):
+ x.add_row([i])
+ newstyle = x.get_string(sortby="Foo", end=10)
+ assert "10" in newstyle
+ assert "20" not in newstyle
+ oldstyle = x.get_string(sortby="Foo", end=10, oldsortslice=True)
+ assert "10" not in oldstyle
+ assert "20" in oldstyle
+
class IntegerFormatBasicTests(BasicTests):
"""Run the basic tests after setting an integer format string"""