Tests: Updated to non-deprecated Boolean values

This commit is contained in:
Paul Beckingham 2016-09-04 16:13:23 -04:00
parent 0b729b5d97
commit d8bf209f29
23 changed files with 57 additions and 57 deletions

View file

@ -81,7 +81,7 @@ class TestAnnotate(TestCase):
self.t.config("report.rrr.columns", "id,description")
self.t.config("report.rrr.sort", "id+")
self.t.config("dateformat", "m/d/Y")
self.t.config("color", "off")
self.t.config("color", "0")
code, out, err = self.t("rrr")
@ -154,7 +154,7 @@ class TestAnnotation(TestCase):
def setUp(self):
"""Executed before each test in the class"""
self.t = Task()
self.t.config("confirmation", "yes")
self.t.config("confirmation", "1")
def test_blank_annotation(self):
"""Verify blank annotations are prevented"""

View file

@ -72,7 +72,7 @@ class Task(object):
def activate_hooks(self):
"""Enable self.hooks functionality and activate hooks on config
"""
self.config("hooks", "on")
self.config("hooks", "1")
self.hooks = Hooks(self.datadir)
def reset_env(self):

View file

@ -47,50 +47,50 @@ class TestBulk(TestCase):
self.t("add three")
def test_bulk_confirmations_single_confirmation_off(self):
"""not bulk delete 1 tasks with confirmation:off deletes it"""
"""not bulk delete 1 tasks with confirmation:0 deletes it"""
# Test with 1 task. 1 is a special case.
code, out, err = self.t("1 delete rc.confirmation:off")
code, out, err = self.t("1 delete rc.confirmation:0")
self.assertNotIn("(yes/no)", out)
self.assertNotIn("(yes/no/all/quit)", out)
self.assertIn("Deleting task 1", out)
def test_bulk_confirmations_single_confirmation_on(self):
"""not bulk delete 1 task with confirmation:on and input >y deletes it"""
"""not bulk delete 1 task with confirmation:1 and input >y deletes it"""
# Test with 1 task. 1 is a special case.
code, out, err = self.t("2 delete rc.confirmation:on", input="y\n")
code, out, err = self.t("2 delete rc.confirmation:1", input="y\n")
self.assertIn("(yes/no)", out)
self.assertNotIn("(yes/no/all/quit)", out)
self.assertIn("Deleting task 2", out)
def test_bulk_confirmations_double_confirmation_off(self):
"""not bulk delete 2 tasks with confirmation:off deletes them"""
"""not bulk delete 2 tasks with confirmation:0 deletes them"""
# Test with 2 tasks. 2 is greater than 1 and less than bulk.
code, out, err = self.t("1-2 delete rc.confirmation:off")
code, out, err = self.t("1-2 delete rc.confirmation:0")
self.assertNotIn("(yes/no)", out)
self.assertNotIn("(yes/no/all/quit)", out)
self.assertIn("Deleting task 1", out)
self.assertIn("Deleting task 2", out)
def test_bulk_confirmations_double_confirmation_on(self):
"""not bulk delete 2 tasks with confirmation:on and input >y >y deletes them"""
"""not bulk delete 2 tasks with confirmation:1 and input >y >y deletes them"""
# Test with 2 tasks. 2 is greater than 1 and less than bulk.
code, out, err = self.t("1-2 delete rc.confirmation:on", input="y\ny\n")
code, out, err = self.t("1-2 delete rc.confirmation:1", input="y\ny\n")
self.assertNotIn("(yes/no)", out)
self.assertIn("(yes/no/all/quit)", out)
self.assertIn("Deleting task 1", out)
self.assertIn("Deleting task 2", out)
def test_bulk_confirmations_bulk_confirmation_off(self):
"""bulk delete 3 tasks with confirmation:off always prompts"""
"""bulk delete 3 tasks with confirmation:0 always prompts"""
# Test with 3 tasks. 3 is considered bulk. rc.confirmation has no effect on bulk
# Delete task 1 'one'? (yes/no/all/quit) --> timeout
code, out, err = self.t.runError("1-3 delete rc.confirmation:off")
code, out, err = self.t.runError("1-3 delete rc.confirmation:0")
self.assertNotIn("(yes/no)", out)
self.assertIn("(yes/no/all/quit)", out)
self.assertNotIn("Deleting task", out)
@ -102,7 +102,7 @@ class TestBulk(TestCase):
# Delete task 2 'two'? (yes/no/all/quit) Deleting task 2 'two'.
# Delete task 3 'three'? (yes/no/all/quit) Deleting task 3 'three'.
# Deleted 3 tasks.
code, out, err = self.t("1-3 delete rc.confirmation:off", input="y\ny\ny\n")
code, out, err = self.t("1-3 delete rc.confirmation:0", input="y\ny\ny\n")
self.assertNotIn("(yes/no)", out)
self.assertIn("(yes/no/all/quit)", out)
self.assertIn("Deleting task 1", out)
@ -113,7 +113,7 @@ class TestBulk(TestCase):
"""bulk delete 3 tasks with confirmation:on and input >y >y >y deletes them"""
# Test with 3 tasks. 3 is considered bulk. rc.confirmation has no effect on bulk
code, out, err = self.t("1-3 delete rc.confirmation:on", input="y\ny\ny\n")
code, out, err = self.t("1-3 delete rc.confirmation:1", input="y\ny\ny\n")
self.assertNotIn("(yes/no)", out)
self.assertIn("(yes/no/all/quit)", out)
self.assertIn("Deleting task 1", out)
@ -124,14 +124,14 @@ class TestBulk(TestCase):
"""bulk delete >no deletes nothing"""
# Test with 1 task, denying delete.
code, out, err = self.t.runError("1 delete rc.confirmation:on", input="n\n")
code, out, err = self.t.runError("1 delete rc.confirmation:1", input="n\n")
self.assertIn("(yes/no)", out)
self.assertNotIn("(yes/no/all/quit)", out)
self.assertNotIn("Deleted task 1", out)
self.assertNotIn("Deleting task", out)
# Test with 2 tasks, denying delete.
code, out, err = self.t.runError("1-2 delete rc.confirmation:on", input="n\nn\n")
code, out, err = self.t.runError("1-2 delete rc.confirmation:1", input="n\nn\n")
self.assertNotIn("(yes/no)", out)
self.assertIn("(yes/no/all/quit)", out)
self.assertNotIn("Deleted task 1", out)
@ -139,7 +139,7 @@ class TestBulk(TestCase):
self.assertNotIn("Deleting task", out)
# Test with 3 tasks, denying delete.
code, out, err = self.t.runError("1-3 delete rc.confirmation:on", input="n\nn\nn\n")
code, out, err = self.t.runError("1-3 delete rc.confirmation:1", input="n\nn\nn\n")
self.assertNotIn("(yes/no)", out)
self.assertIn("(yes/no/all/quit)", out)
self.assertNotIn("Deleted task 1", out)
@ -150,7 +150,7 @@ class TestBulk(TestCase):
def test_bulk_delete_all_tests(self):
"""bulk delete >all deletes everything"""
code, out, err = self.t("1-3 delete rc.confirmation:on", input="all\n")
code, out, err = self.t("1-3 delete rc.confirmation:1", input="all\n")
self.assertNotIn("(yes/no)", out)
self.assertIn("(yes/no/all/quit)", out)
self.assertIn("Deleting task 1", out)
@ -161,7 +161,7 @@ class TestBulk(TestCase):
def test_bulk_delete_quit_tests(self):
"""bulk delete >quit deletes nothing"""
code, out, err = self.t.runError("1-3 delete rc.confirmation:on", input="quit\n")
code, out, err = self.t.runError("1-3 delete rc.confirmation:1", input="quit\n")
self.assertNotIn("(yes/no)", out)
self.assertIn("(yes/no/all/quit)", out)
self.assertIn("Deleted 0 tasks", out)

View file

@ -63,7 +63,7 @@ class TestUtf8(TestCase):
"""Text alignment in reports with wide utf8 characters"""
# Originally Bug #455 - Text alignment in reports is broken when text
# contains wide utf8 characters
self.t.config("print.empty.columns", "no")
self.t.config("print.empty.columns", "0")
self.t(("add", "abc", "pro:Bar\u263a"))
self.t("add def pro:Foo")

View file

@ -40,7 +40,7 @@ class BaseTestEnpassant(TestCase):
"""Executed before each test in the class"""
self.t = Task()
# No journal log which may contain the words we are looking for
self.t.config("journal.info", "off")
self.t.config("journal.info", "0")
class TestEnpassantMultiple(BaseTestEnpassant):
@ -84,7 +84,7 @@ class TestEnpassant(BaseTestEnpassant):
def setUp(self):
super(TestEnpassant, self).setUp()
self.t.config("confirmation", "off")
self.t.config("confirmation", "0")
self.t("add one")
self.t("add two")

View file

@ -40,7 +40,7 @@ class TestBug1414(TestCase):
def setUp(self):
self.t = Task()
self.t.config("default.command", "exec echo hello")
self.t.config("verbose", "no")
self.t.config("verbose", "0")
def test_execute(self):
"""use execute"""

View file

@ -40,7 +40,7 @@ class TestFeature559(TestCase):
def setUp(self):
self.t = Task()
self.t.config("exit.on.missing.db", "yes")
self.t.config("exit.on.missing.db", "1")
# NOTE the framework uses TASKDATA and TASKRC to tell taskwarrior where
# data is stored. Since these env variables take precedence over

View file

@ -131,7 +131,7 @@ class TestDefaultProject(TestCase):
def test_time_default_project(self):
"""default.project is not applied when start/stop'ing a task"""
# Allow keeping track of time spent on task
self.t.config("journal.time", "yes")
self.t.config("journal.time", "1")
self.t("add foobar")
code, out, err = self.t("1 info")

View file

@ -47,14 +47,14 @@ class TestGC(TestCase):
def test_gc_off_id(self):
"""ID retained when GC off"""
self.t.config("gc", "off")
self.t.config("gc", "0")
self.t("1 done")
code, out, err = self.t("gctest")
self.assertRegexpMatches(out, "1\s+one", "should still have ID")
def test_gc_off_mod(self):
"""mod by ID after done with gc off"""
self.t.config("gc", "off")
self.t.config("gc", "0")
self.t("1 done")
self.t("gctest")
self.t("2 mod +TWO")
@ -63,7 +63,7 @@ class TestGC(TestCase):
def test_gc_on_id(self):
"""IDs reshuffle after report when GC on"""
self.t.config("gc", "on")
self.t.config("gc", "1")
self.t("1 done")
self.t("2 mod +TWO")
code, out, err = self.t("gctest")

View file

@ -40,7 +40,7 @@ class TestHyphenation(TestCase):
"""Executed before each test in the class"""
self.t = Task()
self.t.config("defaultwidth", "20")
self.t.config("detection", "off")
self.t.config("detection", "0")
self.t.config("verbose", "nothing")
def test_hyphenation_on_space(self):
@ -63,7 +63,7 @@ class TestBug804(TestCase):
def test_hyphenation(self):
"""Verify hyphenation is controllable"""
self.t.config("print.empty.columns", "yes")
self.t.config("print.empty.columns", "1")
self.t.config("report.unittest.labels", "ID,Project,Pri,Description")
self.t.config("report.unittest.columns", "id,project,priority,description")
self.t.config("report.unittest.filter", "status:pending")

View file

@ -192,7 +192,7 @@ class TestImport(TestCase):
_data = """{"uuid":"a0000000-a000-a000-a000-a00000000000","depends":"a1111111-a111-a111-a111-a11111111111","description":"zero","project":"A","status":"pending","entry":"1234567889"}"""
self.t("import", input=self.data1)
self.t("import", input=_data)
self.t.config("json.depends.array", "off")
self.t.config("json.depends.array", "0")
_t = self.t.export("a0000000-a000-a000-a000-a00000000000")[0]
self.assertEqual(_t["depends"], "a1111111-a111-a111-a111-a11111111111")
@ -242,8 +242,8 @@ class TestImportExportRoundtrip(TestCase):
self.t2 = Task()
for client in (self.t1, self.t2):
client.config("dateformat", "m/d/Y")
client.config("verbose", "off")
client.config("dateformat", "m/d/Y")
client.config("verbose", "0")
client.config("defaultwidth", "100")
def _validate_data(self, client):

View file

@ -397,7 +397,7 @@ class TestBug899(TestCase):
def setUp(self):
"""Executed before each test in the class"""
self.t = Task()
self.t.config("verbose", "on")
self.t.config("verbose", "1")
def test_log_project(self):
"""899: Verify task log behaves correctly when logging into a project"""

View file

@ -40,16 +40,16 @@ class TestOverride(TestCase):
def setUp(self):
"""Executed before each test in the class"""
self.t = Task()
self.t.config("regex", "off")
self.t.config("regex", "0")
self.t.config("verbose", "nothing")
def test_override(self):
"""Verify override is displayed in 'show' command"""
code, out, err = self.t("show regex")
self.assertRegexpMatches(out, r"regex +off")
self.assertRegexpMatches(out, r"regex +0")
code, out, err = self.t("rc.regex:on show regex")
self.assertRegexpMatches(out, r"regex +on")
code, out, err = self.t("rc.regex:1 show regex")
self.assertRegexpMatches(out, r"regex +1")
class TestRCSegfault(TestCase):

View file

@ -77,7 +77,7 @@ class TestRecurrenceDisabled(TestCase):
disabled.
"""
self.t.config("recurrence", "no")
self.t.config("recurrence", "0")
self.t("add due:today recur:daily Recurrent task.")
# Trigger GC, expect no match and therefore non-zero code
@ -325,7 +325,7 @@ class TestBug955(TestCase):
"""
# With confirmation:off the first "n\n" has no effect.
self.t.config("confirmation", "off")
self.t.config("confirmation", "0")
code, out, err = self.t("2 delete", input="n\ny\n")
self.assertIn("Deleting task 2", out)
self.assertIn("Deleted 1 task", out)
@ -351,7 +351,7 @@ class TestBug955(TestCase):
"""
# With confirmation:on the first "n\n" is obeyed.
self.t.config("confirmation", "on")
self.t.config("confirmation", "1")
code, out, err = self.t.runError("2 delete", input="n\ny\n")
self.assertIn("Deleted 0 tasks.", out)

View file

@ -80,7 +80,7 @@ class TestShowHelperCommand(TestCase):
def test_show_helper_no_arg(self):
"""Verify _show command lists all with no arg provided"""
code, out, err = self.t("_show")
self.assertIn("debug=no\n", out)
self.assertIn("debug=0\n", out)
self.assertIn("verbose=", out)

View file

@ -47,7 +47,7 @@ class TestSpecialTags(TestCase):
cls.t.config("color.pri.H", "")
cls.t.config("color.completed", "")
cls.t.config("nag", "NAG")
cls.t.config("color", "on")
cls.t.config("color", "1")
cls.t.config("_forcecolor", "1")
def test_nocolor(self):

View file

@ -69,7 +69,7 @@ class TestStart(TestCase):
def test_journal_time(self):
"""Verify journal.time tracks state"""
self.t.config("journal.time", "on")
self.t.config("journal.time", "1")
self.t("add one")
self.t("1 start")
@ -82,7 +82,7 @@ class TestStart(TestCase):
def test_journal_annotations(self):
"""Verify journal start/stop annotations are used"""
self.t.config("journal.time", "on")
self.t.config("journal.time", "1")
self.t.config("journal.time.start.annotation", "Nu kör vi")
self.t.config("journal.time.stop.annotation", "Nu stannar vi")

View file

@ -43,7 +43,7 @@ class TestSubstitutions(TestCase):
def test_substitution(self):
"""Verify substitution for task description"""
self.t.config("regex", "off")
self.t.config("regex", "0")
self.t("add foo foo foo")
self.t("1 modify /foo/FOO/")
@ -78,7 +78,7 @@ class TestSubstitutions(TestCase):
def test_substitution_regex(self):
"""Verify regex substitution for task description"""
self.t.config("regex", "on")
self.t.config("regex", "1")
self.t("add aaa bbb")
self.t("1 modify /b{3}/BbB/")
code, out, err = self.t("_get 1.description")

View file

@ -50,7 +50,7 @@ class TestSugar(TestCase):
self.assertIn("two", out)
self.assertNotIn("three", out)
self.t.config("sugar", "off")
self.t.config("sugar", "0")
code, out, err = self.t("1 2 count")
self.assertEqual(0, int(out))
@ -64,7 +64,7 @@ class TestSugar(TestCase):
self.assertIn("three", out)
# sugar off: WYSIWYG parsing.
self.t.config("sugar", "off")
self.t.config("sugar", "0")
code, out, err = self.t("3 and '( 2 three )' count")
self.assertEqual(0, int(out))

View file

@ -52,8 +52,8 @@ int main (int, char**)
unlink ("./backlog.data");
// Set the context to allow GC.
context.config.set ("gc", "on");
context.config.set ("debug", "on");
context.config.set ("gc", 1);
context.config.set ("debug", 1);
context.tdb2.set_location (".");

View file

@ -54,7 +54,7 @@ class TestUrgency(TestCase):
cls.t.config("urgency.user.tag.next.coefficient", "10")
cls.t.config("urgency.user.project.PROJECT.coefficient", "10")
cls.t.config("urgency.user.tag.TAG.coefficient", "10")
cls.t.config("confirmation", "off")
cls.t.config("confirmation", "0")
cls.t("add control") # 1

View file

@ -62,16 +62,16 @@ class TestUrgencyInherit(TestCase):
def test_urgency_inherit_off(self):
"""No urgency inheritance when switched off"""
self.t.config("urgency.inherit", "off")
self.t.config("urgency.inherit", "0")
tl = self.get_tasks()
self.assertTrue(tl[1]["urgency"] <= tl[2]["urgency"] < tl[3]["urgency"])
def test_gc_off_mod(self):
"""Biggest urgency is inherited recursively"""
self.t.config("urgency.inherit", "off")
self.t.config("urgency.inherit", "0")
tl = self.get_tasks()
oldmax = max(tl[1]["urgency"], tl[2]["urgency"], tl[3]["urgency"])
self.t.config("urgency.inherit", "on")
self.t.config("urgency.inherit", "1")
tl = self.get_tasks()
self.assertTrue(oldmax <= tl[3]["urgency"])
self.assertTrue(tl[1]["urgency"] >= tl[2]["urgency"] >= tl[3]["urgency"])

View file

@ -41,7 +41,7 @@ from basetest import Task, TestCase
class TestVerbosity(TestCase):
def setUp(self):
self.t = Task()
self.t.config("print.empty.columns", "yes")
self.t.config("print.empty.columns", "1")
self.t("add Sample")