mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-05 04:57:21 +02:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
cfa0370489
commit
eff49f2bd6
1 changed files with 28 additions and 7 deletions
|
@ -34,6 +34,7 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
from basetest import Task, TestCase
|
from basetest import Task, TestCase
|
||||||
|
|
||||||
|
|
||||||
class TestRandomSort(TestCase):
|
class TestRandomSort(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.t = Task()
|
self.t = Task()
|
||||||
|
@ -46,20 +47,40 @@ class TestRandomSort(TestCase):
|
||||||
def test_random_sort_deterministic(self):
|
def test_random_sort_deterministic(self):
|
||||||
"""Verify that 'sort:random' with different seeds produces different orderings."""
|
"""Verify that 'sort:random' with different seeds produces different orderings."""
|
||||||
# With a fixed seed, the order is always the same.
|
# With a fixed seed, the order is always the same.
|
||||||
code, out1_seed1, err = self.t("rc.debug.random.seed=123 all rc.report.all.sort:random")
|
code, out1_seed1, err = self.t(
|
||||||
code, out2_seed1, err = self.t("rc.debug.random.seed=123 all rc.report.all.sort:random")
|
"rc.debug.random.seed=123 all rc.report.all.sort:random"
|
||||||
self.assertEqual(out1_seed1, out2_seed1, "Random sort with the same seed should produce the same order")
|
)
|
||||||
|
code, out2_seed1, err = self.t(
|
||||||
|
"rc.debug.random.seed=123 all rc.report.all.sort:random"
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
out1_seed1,
|
||||||
|
out2_seed1,
|
||||||
|
"Random sort with the same seed should produce the same order",
|
||||||
|
)
|
||||||
|
|
||||||
# With a different fixed seed, the order is different.
|
# With a different fixed seed, the order is different.
|
||||||
code, out1_seed2, err = self.t("rc.debug.random.seed=456 all rc.report.all.sort:random")
|
code, out1_seed2, err = self.t(
|
||||||
self.assertNotEqual(out1_seed1, out1_seed2, "Random sort with different seeds should produce different orders")
|
"rc.debug.random.seed=456 all rc.report.all.sort:random"
|
||||||
|
)
|
||||||
|
self.assertNotEqual(
|
||||||
|
out1_seed1,
|
||||||
|
out1_seed2,
|
||||||
|
"Random sort with different seeds should produce different orders",
|
||||||
|
)
|
||||||
|
|
||||||
def test_random_and_id_sort(self):
|
def test_random_and_id_sort(self):
|
||||||
"""Verify that 'sort:random,id' is not the same as 'sort:id'."""
|
"""Verify that 'sort:random,id' is not the same as 'sort:id'."""
|
||||||
code, out_id, err = self.t("all rc.report.all.sort:id")
|
code, out_id, err = self.t("all rc.report.all.sort:id")
|
||||||
code, out_random_id, err = self.t("rc.debug.random.seed=123 all rc.report.all.sort:random,id")
|
code, out_random_id, err = self.t(
|
||||||
self.assertNotEqual(out_id, out_random_id, "random,id sort should be different from id sort")
|
"rc.debug.random.seed=123 all rc.report.all.sort:random,id"
|
||||||
|
)
|
||||||
|
self.assertNotEqual(
|
||||||
|
out_id, out_random_id, "random,id sort should be different from id sort"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
from simpletap import TAPTestRunner
|
from simpletap import TAPTestRunner
|
||||||
|
|
||||||
unittest.main(testRunner=TAPTestRunner())
|
unittest.main(testRunner=TAPTestRunner())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue