mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
tests: Add test for default sorting of UDA strings
This commit is contained in:
parent
514c869aea
commit
ec4a7abb06
1 changed files with 38 additions and 3 deletions
|
@ -50,7 +50,7 @@ class TestUDACustomSort(TestCase):
|
|||
cls.t('add one')
|
||||
|
||||
def test_ascending(self):
|
||||
"""Ascending sort order"""
|
||||
"""Ascending custom sort order"""
|
||||
self.t.config('uda.foo.values', 'H,M,L,')
|
||||
code, out, err = self.t('rc.report.list.sort:foo+ list')
|
||||
|
||||
|
@ -64,7 +64,7 @@ class TestUDACustomSort(TestCase):
|
|||
self.assertTrue(three < four)
|
||||
|
||||
def test_descending(self):
|
||||
"""Descending sort order"""
|
||||
"""Descending custom sort order"""
|
||||
self.t.config('uda.foo.values', 'H,M,L,')
|
||||
code, out, err = self.t('rc.report.list.sort:foo- list')
|
||||
|
||||
|
@ -78,7 +78,7 @@ class TestUDACustomSort(TestCase):
|
|||
self.assertTrue(two < one)
|
||||
|
||||
def test_ridiculous(self):
|
||||
"""Ridiculous sort order"""
|
||||
"""Ridiculous custom sort order"""
|
||||
self.t.config('uda.foo.values', 'H,M,,L')
|
||||
code, out, err = self.t('rc.report.list.sort:foo- list')
|
||||
|
||||
|
@ -91,6 +91,41 @@ class TestUDACustomSort(TestCase):
|
|||
self.assertTrue(three < one)
|
||||
self.assertTrue(one < two)
|
||||
|
||||
|
||||
class TestUDADefaultSort(TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.t = Task()
|
||||
cls.t.config('uda.foo.type', 'string')
|
||||
cls.t.config('uda.foo.label', 'Foo')
|
||||
cls.t.config('report.list.columns', 'id,description,foo')
|
||||
cls.t.config('report.list.labels', 'ID,Desc,Foo')
|
||||
cls.t('add one foo:A')
|
||||
cls.t('add three')
|
||||
cls.t('add two foo:B')
|
||||
|
||||
def test_ascending(self):
|
||||
"""Ascending default sort order"""
|
||||
code, out, err = self.t('rc.report.list.sort:foo+ list')
|
||||
|
||||
one = out.find('one')
|
||||
two = out.find('two')
|
||||
three = out.find('three')
|
||||
|
||||
self.assertTrue(one < two)
|
||||
self.assertTrue(two < three)
|
||||
|
||||
def test_descending(self):
|
||||
"""Descending default sort order"""
|
||||
code, out, err = self.t('rc.report.list.sort:foo- list')
|
||||
|
||||
one = out.find('one')
|
||||
two = out.find('two')
|
||||
three = out.find('three')
|
||||
|
||||
self.assertTrue(one < three)
|
||||
self.assertTrue(two < one)
|
||||
|
||||
if __name__ == "__main__":
|
||||
from simpletap import TAPTestRunner
|
||||
unittest.main(testRunner=TAPTestRunner())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue