tests: Use updated unittest methods

This commit is contained in:
Tomas Babej 2020-11-21 12:39:03 -05:00
parent 720c561b75
commit 52c49169b4
No known key found for this signature in database
GPG key ID: B0747C6578F7D2F5
50 changed files with 315 additions and 315 deletions

View file

@ -109,7 +109,7 @@ class TestBug1006(TestCase):
expected = "Description +des\n"
errormsg = "Attribute not completed in description"
self.assertRegexpMatches(out, expected, msg=errormsg)
self.assertRegex(out, expected, msg=errormsg)
notexpected = "description"
self.assertNotIn(notexpected, out, msg=errormsg)

View file

@ -172,7 +172,7 @@ class TestBug1031(TestCase):
code, out, err = self.t("1 info")
expected = "Description\s+to"
self.assertRegexpMatches(out, expected)
self.assertRegex(out, expected)
def test_alias_to_to(self):
"""1031: alias working as expected: 'from -- to' -> 'to to'"""
@ -180,7 +180,7 @@ class TestBug1031(TestCase):
code, out, err = self.t("1 info")
expected = "Description\s+to to"
self.assertRegexpMatches(out, expected)
self.assertRegex(out, expected)
def test_alias_to_from(self):
"""1031: alias working as expected: 'to -- from' -> 'to from'"""
@ -188,7 +188,7 @@ class TestBug1031(TestCase):
code, out, err = self.t("1 info")
expected = "Description\s+to from"
self.assertRegexpMatches(out, expected)
self.assertRegex(out, expected)
class Test1445(TestCase):

View file

@ -87,17 +87,17 @@ class TestAnnotate(TestCase):
self.assertTasksExist(out)
self.assertRegexpMatches(out, "one\n.+\d{1,2}/\d{1,2}/\d{4}\s+foo1",
self.assertRegex(out, "one\n.+\d{1,2}/\d{1,2}/\d{4}\s+foo1",
msg='full - first annotation task 1')
self.assertRegexpMatches(out, "foo1\n.+\d{1,2}/\d{1,2}/\d{4}\s+foo2",
self.assertRegex(out, "foo1\n.+\d{1,2}/\d{1,2}/\d{4}\s+foo2",
msg='full - first annotation task 1')
self.assertRegexpMatches(out, "foo2\n.+\d{1,2}/\d{1,2}/\d{4}\s+foo3",
self.assertRegex(out, "foo2\n.+\d{1,2}/\d{1,2}/\d{4}\s+foo3",
msg='full - first annotation task 1')
self.assertRegexpMatches(out, "two\n.+\d{1,2}/\d{1,2}/\d{4}\s+bar1",
self.assertRegex(out, "two\n.+\d{1,2}/\d{1,2}/\d{4}\s+bar1",
msg='full - first annotation task 1')
self.assertRegexpMatches(out, "bar1\n.+\d{1,2}/\d{1,2}/\d{4}\s+bar2",
self.assertRegex(out, "bar1\n.+\d{1,2}/\d{1,2}/\d{4}\s+bar2",
msg='full - first annotation task 1')
self.assertRegexpMatches(out, "three\n.+\d{1,2}/\d{1,2}/\d{4}\s+baz1",
self.assertRegex(out, "three\n.+\d{1,2}/\d{1,2}/\d{4}\s+baz1",
msg='full - first annotation task 1')
def test_annotate_dateformat(self):
@ -114,17 +114,17 @@ class TestAnnotate(TestCase):
self.assertTasksExist(out)
self.assertRegexpMatches(out, "one\n.+\d{1,6}\s+\d{1,6}\s+foo1",
self.assertRegex(out, "one\n.+\d{1,6}\s+\d{1,6}\s+foo1",
msg="dateformat - first annotation task 1")
self.assertRegexpMatches(out, "foo1\n.+\d{1,6}\s+\d{1,6}\s+foo2",
self.assertRegex(out, "foo1\n.+\d{1,6}\s+\d{1,6}\s+foo2",
msg="dateformat - second annotation task 1")
self.assertRegexpMatches(out, "foo2\n.+\d{1,6}\s+\d{1,6}\s+foo3",
self.assertRegex(out, "foo2\n.+\d{1,6}\s+\d{1,6}\s+foo3",
msg="dateformat - third annotation task 1")
self.assertRegexpMatches(out, "two\n.+\d{1,6}\s+\d{1,6}\s+bar1",
self.assertRegex(out, "two\n.+\d{1,6}\s+\d{1,6}\s+bar1",
msg="dateformat - first annotation task 2")
self.assertRegexpMatches(out, "bar1\n.+\d{1,6}\s+\d{1,6}\s+bar2",
self.assertRegex(out, "bar1\n.+\d{1,6}\s+\d{1,6}\s+bar2",
msg="dateformat - second annotation task 2")
self.assertRegexpMatches(out, "three\n.+\d{1,6}\s+\d{1,6}\s+baz1",
self.assertRegex(out, "three\n.+\d{1,6}\s+\d{1,6}\s+baz1",
msg="dateformat - first annotation task 3")
class TestAnnotationPropagation(TestCase):

View file

@ -51,7 +51,7 @@ class TestAppend(TestCase):
code, out, err = self.t("info 1")
expected = "Description\s+foo\sbar\n"
self.assertRegexpMatches(out, expected)
self.assertRegex(out, expected)
def test_append_error_on_empty(self):
"""Should cause an error when nothing is appended"""
@ -82,10 +82,10 @@ class TestBug440(TestCase):
code2, out2, err2 = self.t("2 ls")
self.assertNotIn("Foo", out1)
self.assertRegexpMatches(out1, "\w+ Appendtext")
self.assertRegex(out1, "\w+ Appendtext")
self.assertNotIn("Foo", out2)
self.assertRegexpMatches(out2, "\w+ Appendtext")
self.assertRegex(out2, "\w+ Appendtext")
if __name__ == "__main__":

View file

@ -51,7 +51,7 @@ class TestCalc(TestCase):
self.assertIn("Eval literal number ↑'3600'", out)
self.assertIn("Eval literal number ↑'60'", out)
self.assertIn("Eval literal number ↑'56'", out)
self.assertRegexpMatches(out, re.compile("^45296$", re.MULTILINE))
self.assertRegex(out, re.compile("^45296$", re.MULTILINE))
self.assertNotIn("Error", out)
self.assertNotIn("Error", err)
@ -63,7 +63,7 @@ class TestCalc(TestCase):
self.assertIn("Eval literal number ↑'3600'", out)
self.assertIn("Eval literal number ↑'60'", out)
self.assertIn("Eval literal number ↑'56'", out)
self.assertRegexpMatches(out, re.compile("^45296$", re.MULTILINE))
self.assertRegex(out, re.compile("^45296$", re.MULTILINE))
self.assertNotIn("Error", out)
self.assertNotIn("Error", err)
@ -74,7 +74,7 @@ class TestCalc(TestCase):
self.assertIn("Eval literal number ↑'2'", out)
self.assertIn("Eval _neg_ ↓'3' → ↑'-3'", out)
self.assertIn("Eval literal number ↑'2'", out)
self.assertRegexpMatches(out, re.compile("^5$", re.MULTILINE))
self.assertRegex(out, re.compile("^5$", re.MULTILINE))
self.assertNotIn("Error", out)
self.assertNotIn("Error", err)
@ -90,7 +90,7 @@ class TestCalc(TestCase):
"""version"""
code, out, err = run_cmd_wait_nofail((CALC, "--version"))
self.assertRegexpMatches(out, "calc \d\.\d+\.\d+")
self.assertRegex(out, "calc \d\.\d+\.\d+")
self.assertIn("Copyright", out)
self.assertGreaterEqual(code, 1)
@ -103,7 +103,7 @@ class TestCalc(TestCase):
self.assertNotIn("Error: Unexpected stack size: 2", out)
self.assertNotIn("Error: Unexpected stack size: 2", err)
self.assertIn("Eval literal duration ↑'PT15M'", out)
self.assertRegexpMatches(out, re.compile("^PT15M$", re.MULTILINE))
self.assertRegex(out, re.compile("^PT15M$", re.MULTILINE))
class TestBug1254(TestCase):

View file

@ -58,7 +58,7 @@ class TestCalendarCommandLine(TestCase):
def test_basic_command_color(self):
"""Verify 'calendar rc._forcecolor:on' does not fail"""
code, out, err = self.t("calendar rc._forcecolor:on")
self.assertRegexpMatches(out, "Su.+Mo.+Tu.+We.+Th.+Fr.+Sa")
self.assertRegex(out, "Su.+Mo.+Tu.+We.+Th.+Fr.+Sa")
def test_basic_command_details(self):
"""Verify 'calendar rc.calendar.details:full rc.calendar.details.report:list' does not fail"""

View file

@ -63,17 +63,17 @@ class TestColorCommand(TestCase):
def test_colors_sample(self):
""" Verify 'task colors red' shows a sample"""
code, out, err = self.t("colors rc._forcecolor:on red")
self.assertRegexpMatches(out, "Your sample:\n\n .\[31mtask color red.\[0m")
self.assertRegex(out, "Your sample:\n\n .\[31mtask color red.\[0m")
def test_colors_legend(self):
""" Verify 'task colors legend' shows theme colors"""
code, out, err = self.t("colors rc._forcecolor:on legend")
self.assertRegexpMatches(out, "color.debug\s+.\[0m\s.\[38;5;4mcolor4\s+.\[0m")
self.assertRegex(out, "color.debug\s+.\[0m\s.\[38;5;4mcolor4\s+.\[0m")
def test_colors_legend_override(self):
"""Verify 'task colors legend' obeys rc overrides"""
code, out, err = self.t("colors rc._forcecolor:on rc.color.debug:red legend")
self.assertRegexpMatches(out, "color.debug\s+.\[0m\s.\[31mred\s+.\[0m")
self.assertRegex(out, "color.debug\s+.\[0m\s.\[31mred\s+.\[0m")
if __name__ == "__main__":
from simpletap import TAPTestRunner

View file

@ -54,7 +54,7 @@ class TestDescriptionFormats(TestCase):
"""Verify formatting of 'description.combined' column"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,description.combined")
self.assertIn("one long description to exceed a certain string size", out)
self.assertRegexpMatches(out, r"\d{4}-\d{2}-\d{2} annotation")
self.assertRegex(out, r"\d{4}-\d{2}-\d{2} annotation")
self.assertNotIn("[1]", out)
def test_description_desc(self):
@ -66,7 +66,7 @@ class TestDescriptionFormats(TestCase):
def test_description_oneline(self):
"""Verify formatting of 'description.oneline' column"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,description.oneline")
self.assertRegexpMatches(out, r"one long description to exceed a certain string size \d{4}-\d{2}-\d{2}")
self.assertRegex(out, r"one long description to exceed a certain string size \d{4}-\d{2}-\d{2}")
self.assertIn("annotation", out)
self.assertNotIn("[1]", out)
@ -243,14 +243,14 @@ class TestRecurringAttributeFormats(TestCase):
def test_recurrence_formats_short(self):
"""Verify formatting of assorted short recurrence columns"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,status,due,recur.indicator,mask,imask,parent.short")
self.assertRegexpMatches(out, "1\sRecurring\s+\d{4}-\d{2}-\d{2}\s+R\s+-")
self.assertRegexpMatches(out, "2\sPending\s+\d{4}-\d{2}-\d{2}\s+R\s+0\s+[0-9a-fA-F]{8}")
self.assertRegex(out, "1\sRecurring\s+\d{4}-\d{2}-\d{2}\s+R\s+-")
self.assertRegex(out, "2\sPending\s+\d{4}-\d{2}-\d{2}\s+R\s+0\s+[0-9a-fA-F]{8}")
def test_recurrence_formats_long(self):
"""Verify formatting of assorted long recurrence columns"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,status,due,recur.duration,mask,imask,parent.long")
self.assertRegexpMatches(out, "1\sRecurring\s+\d{4}-\d{2}-\d{2}\s+P30D\s+-")
self.assertRegexpMatches(out, "2\sPending\s+\d{4}-\d{2}-\d{2}\s+P30D\s+0\s+[0-9a-fA-F-]{36}")
self.assertRegex(out, "1\sRecurring\s+\d{4}-\d{2}-\d{2}\s+P30D\s+-")
self.assertRegex(out, "2\sPending\s+\d{4}-\d{2}-\d{2}\s+P30D\s+0\s+[0-9a-fA-F-]{36}")
def test_recurrence_format_unrecognized(self):
"""Verify *.donkey formatting fails"""
@ -279,23 +279,23 @@ class TestProjectFormats(TestCase):
def test_project_format_full(self):
"""Verify project.full formatting"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,project.full,description")
self.assertRegexpMatches(out, r'1\s+TOP\s+one')
self.assertRegexpMatches(out, r'2\s+TOP.MIDDLE\s+two')
self.assertRegexpMatches(out, r'3\s+TOP.MIDDLE.BOTTOM\s+three')
self.assertRegex(out, r'1\s+TOP\s+one')
self.assertRegex(out, r'2\s+TOP.MIDDLE\s+two')
self.assertRegex(out, r'3\s+TOP.MIDDLE.BOTTOM\s+three')
def test_project_format_parent(self):
"""Verify project.parent formatting"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,project.parent,description")
self.assertRegexpMatches(out, r'1\s+TOP\s+one')
self.assertRegexpMatches(out, r'2\s+TOP\s+two')
self.assertRegexpMatches(out, r'3\s+TOP\s+three')
self.assertRegex(out, r'1\s+TOP\s+one')
self.assertRegex(out, r'2\s+TOP\s+two')
self.assertRegex(out, r'3\s+TOP\s+three')
def test_project_format_indented(self):
"""Verify project.indented formatting"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,project.indented,description")
self.assertRegexpMatches(out, r'1\s+TOP\s+one')
self.assertRegexpMatches(out, r'2\s+MIDDLE\s+two')
self.assertRegexpMatches(out, r'3\s+BOTTOM\s+three')
self.assertRegex(out, r'1\s+TOP\s+one')
self.assertRegex(out, r'2\s+MIDDLE\s+two')
self.assertRegex(out, r'3\s+BOTTOM\s+three')
def test_project_format_unrecognized(self):
"""Verify project.donkey formatting fails"""
@ -316,17 +316,17 @@ class TestTagsFormats(TestCase):
def test_tags_format_list(self):
"""Verify tags.list formatting"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,tags.list")
self.assertRegexpMatches(out, r'1\s+tag1\stag2$')
self.assertRegex(out, r'1\s+tag1\stag2$')
def test_tags_format_indicator(self):
"""Verify tags.indicator formatting"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,tags.indicator")
self.assertRegexpMatches(out, r'1\s+\+$')
self.assertRegex(out, r'1\s+\+$')
def test_tags_format_count(self):
"""Verify tags.count formatting"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,tags.count")
self.assertRegexpMatches(out, r'1\s+\[2\]$')
self.assertRegex(out, r'1\s+\[2\]$')
def test_tags_format_unrecognized(self):
"""Verify tags.donkey formatting fails"""
@ -348,50 +348,50 @@ class TestDateFormats(TestCase):
def test_date_format_formatted(self):
"""Verify due.formatted formatting"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,due.formatted")
self.assertRegexpMatches(out, r'1\s+\d{4}-\d{2}-\d{2}')
self.assertRegexpMatches(out, r'2\s+\d{4}-\d{2}-\d{2}')
self.assertRegex(out, r'1\s+\d{4}-\d{2}-\d{2}')
self.assertRegex(out, r'2\s+\d{4}-\d{2}-\d{2}')
def test_date_format_julian(self):
"""Verify due.julian formatting"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,due.julian")
self.assertRegexpMatches(out, r'1\s+\d+\.\d+')
self.assertRegexpMatches(out, r'2\s+\d+\.\d+')
self.assertRegex(out, r'1\s+\d+\.\d+')
self.assertRegex(out, r'2\s+\d+\.\d+')
def test_date_format_epoch(self):
"""Verify due.epoch formatting"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,due.epoch")
self.assertRegexpMatches(out, r'1\s+\d{10}')
self.assertRegexpMatches(out, r'2\s+\d{10}')
self.assertRegex(out, r'1\s+\d{10}')
self.assertRegex(out, r'2\s+\d{10}')
def test_date_format_iso(self):
"""Verify due.iso formatting"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,due.iso")
self.assertRegexpMatches(out, r'1\s+\d{8}T\d{6}Z')
self.assertRegexpMatches(out, r'2\s+\d{8}T\d{6}Z')
self.assertRegex(out, r'1\s+\d{8}T\d{6}Z')
self.assertRegex(out, r'2\s+\d{8}T\d{6}Z')
def test_date_format_age(self):
"""Verify due.age formatting"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,due.age")
self.assertRegexpMatches(out, r'1\s+[0-9.]+d')
self.assertRegexpMatches(out, r'2\s+-[0-9.]+[hmin]+')
self.assertRegex(out, r'1\s+[0-9.]+d')
self.assertRegex(out, r'2\s+-[0-9.]+[hmin]+')
def test_date_format_remaining(self):
"""Verify due.remaining formatting"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,due.remaining")
self.assertRegexpMatches(out, r'1')
self.assertRegexpMatches(out, r'2\s+\d+\S+')
self.assertRegex(out, r'1')
self.assertRegex(out, r'2\s+\d+\S+')
def test_date_format_relative(self):
"""Verify due.relative formatting"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,due.relative")
self.assertRegexpMatches(out, r'1\s+-[0-9.]+d')
self.assertRegexpMatches(out, r'2\s+[0-9.]+[hmin]+')
self.assertRegex(out, r'1\s+-[0-9.]+d')
self.assertRegex(out, r'2\s+[0-9.]+[hmin]+')
def test_date_format_countdown(self):
"""Verify due.countdown formatting"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,due.countdown")
self.assertRegexpMatches(out, r'1\s+\d+\S+')
self.assertRegexpMatches(out, r'2\s+')
self.assertRegex(out, r'1\s+\d+\S+')
self.assertRegex(out, r'2\s+')
def test_date_format_unrecognized(self):
"""Verify due.donkey formatting fails"""
@ -430,12 +430,12 @@ class TestUDAFormats(TestCase):
def test_uda_format_formatted(self):
"""Verify priority.default formatting"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,priority.default")
self.assertRegexpMatches(out, r'1\s+H')
self.assertRegex(out, r'1\s+H')
def test_uda_format_indicator(self):
"""Verify priority.indicator formatting"""
code, out, err = self.t("xxx rc.report.xxx.columns:id,priority.indicator")
self.assertRegexpMatches(out, r'1\s+P')
self.assertRegex(out, r'1\s+P')
def test_uda_format_unrecognized(self):
"""Verify priority.donkey formatting fails"""

View file

@ -42,16 +42,16 @@ class TestCommands(TestCase):
def test_command_dna(self):
"""Verify 'add', 'modify', 'list' dna"""
code, out, err = self.t("commands")
self.assertRegexpMatches(out, "add\s+operation\s+RW\s+Mods\s+Adds a new task")
self.assertRegexpMatches(out, "list\s+report\s+RO\s+ID\s+GC\s+Ctxt\s+Filt\s+Most details of")
self.assertRegexpMatches(out, "modify\s+operation\s+RW\s+Filt\s+Mods\s+Modifies the")
self.assertRegex(out, "add\s+operation\s+RW\s+Mods\s+Adds a new task")
self.assertRegex(out, "list\s+report\s+RO\s+ID\s+GC\s+Ctxt\s+Filt\s+Most details of")
self.assertRegex(out, "modify\s+operation\s+RW\s+Filt\s+Mods\s+Modifies the")
def test_command_dna_color(self):
"""Verify 'add', 'modify', 'list' dna"""
code, out, err = self.t("commands rc._forcecolor:on")
self.assertRegexpMatches(out, "add\s+operation\s+RW\s+Mods\s+Adds a new task")
self.assertRegexpMatches(out, "list\s+report\s+RO\s+ID\s+GC\s+Ctxt\s+Filt\s+Most details of")
self.assertRegexpMatches(out, "modify\s+operation\s+RW\s+Filt\s+Mods\s+Modifies the")
self.assertRegex(out, "add\s+operation\s+RW\s+Mods\s+Adds a new task")
self.assertRegex(out, "list\s+report\s+RO\s+ID\s+GC\s+Ctxt\s+Filt\s+Most details of")
self.assertRegex(out, "modify\s+operation\s+RW\s+Filt\s+Mods\s+Modifies the")
if __name__ == "__main__":

View file

@ -48,7 +48,7 @@ class TestCustomReports(TestCase):
def test_custom_report_help(self):
"""Verify custom report description is shown in help"""
code, out, err = self.t("help")
self.assertRegexpMatches(out, "task <filter> foo\s+DESC\n")
self.assertRegex(out, "task <filter> foo\s+DESC\n")
def test_custom_filter(self):
"""Verify custome report filtr is applied"""

View file

@ -51,13 +51,13 @@ class TestCustomTagIndicator(TestCase):
def test_default_indicator(self):
"""Verify default tag indicator (+) is shown"""
code, out, err = self.t("foo")
self.assertRegexpMatches(out, "ID.+T")
self.assertRegexpMatches(out, "1\s+\+")
self.assertRegex(out, "ID.+T")
self.assertRegex(out, "1\s+\+")
def test_custom_indicator(self):
"""Verify custom tag indicator (TAG) is shown"""
code, out, err = self.t("rc.tag.indicator:TAG foo")
self.assertRegexpMatches(out, "1\s+TAG")
self.assertRegex(out, "1\s+TAG")
if __name__ == "__main__":

View file

@ -47,7 +47,7 @@ class TestDateISOAndEpoch(TestCase):
# Partial date, because _get returns local time, and that would make
# the test sensitive to TZ.
code, out, err = self.t("_get 1.due")
self.assertRegexpMatches(out, "^2015-07-0.T..:..:..$")
self.assertRegex(out, "^2015-07-0.T..:..:..$")
def test_epoch(self):
"""Verify adding epoch dates works regardless of rc.dateformat"""
@ -56,7 +56,7 @@ class TestDateISOAndEpoch(TestCase):
# Partial date, because _get returns local time, and that would make
# the test sensitive to TZ.
code, out, err = self.t("_get 1.due")
self.assertRegexpMatches(out, "^2009-02-1.T..:..:..$")
self.assertRegex(out, "^2009-02-1.T..:..:..$")
if __name__ == "__main__":

View file

@ -52,7 +52,7 @@ class TestCMD(TestCase):
def test_info_command(self):
"""info command"""
code, out, err = self.t('1')
self.assertRegexpMatches(out, 'Description\s+one')
self.assertRegex(out, 'Description\s+one')
class TestDefaults(TestCase):

View file

@ -48,8 +48,8 @@ class TestDiagnostics(TestCase):
self.t.activate_hooks()
code, out, err = self.t.diag()
self.tap(out)
self.assertRegexpMatches(out, "Compliance:\s+C\+\+14")
self.assertRegexpMatches(out, "libgnutls:\s+\d+\.\d+\.\d+")
self.assertRegex(out, "Compliance:\s+C\+\+14")
self.assertRegex(out, "libgnutls:\s+\d+\.\d+\.\d+")
self.assertIn("edlin", out)
self.assertIn("strict", out)

View file

@ -159,12 +159,12 @@ class TestDOM(TestCase):
def test_dom_annotation_entry(self):
""" DOM 3.annotations.1.entry """
code, out, err = self.t("_get 3.annotations.1.entry")
self.assertRegexpMatches(out, r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}")
self.assertRegex(out, r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}")
def test_dom_annotation_entry_second(self):
""" DOM 3.annotations.1.entry """
code, out, err = self.t("_get 3.annotations.1.entry.second")
self.assertRegexpMatches(out, r"\d{1,2}")
self.assertRegex(out, r"\d{1,2}")
def test_dom_annotation_description(self):
""" DOM 3.annotations.1.description """
@ -175,7 +175,7 @@ class TestDOM(TestCase):
""" DOM system.version """
code, out, err = self.t("_get system.version")
self.assertEqual(code, 0)
self.assertRegexpMatches(out, r"\d\.\d+\.\d+")
self.assertRegex(out, r"\d\.\d+\.\d+")
def test_dom_system_os(self):
""" DOM system.os """
@ -200,19 +200,19 @@ class TestDOM(TestCase):
""" DOM tw.width """
code, out, err = self.t("_get tw.width")
self.assertEqual(code, 0)
self.assertRegexpMatches(out, r"\d+")
self.assertRegex(out, r"\d+")
def test_dom_tw_height(self):
""" DOM tw.height """
code, out, err = self.t("_get tw.height")
self.assertEqual(code, 0)
self.assertRegexpMatches(out, r"\d+")
self.assertRegex(out, r"\d+")
def test_dom_tw_version(self):
""" DOM tw.version """
code, out, err = self.t("_get tw.version")
self.assertEqual(code, 0)
self.assertRegexpMatches(out, r"\d\.\d+\.\d+")
self.assertRegex(out, r"\d\.\d+\.\d+")
def test_dom_context_program(self):
""" DOM context.program """
@ -230,13 +230,13 @@ class TestDOM(TestCase):
""" DOM context.width """
code, out, err = self.t("_get context.width")
self.assertEqual(code, 0)
self.assertRegexpMatches(out, r"\d+")
self.assertRegex(out, r"\d+")
def test_dom_context_height(self):
""" DOM context.height """
code, out, err = self.t("_get context.height")
self.assertEqual(code, 0)
self.assertRegexpMatches(out, r"\d+")
self.assertRegex(out, r"\d+")
def test_dom_rc_name(self):
""" DOM rc.dateformat """

View file

@ -64,8 +64,8 @@ class TestDue(TestCase):
def test_due(self):
"""due tasks displayed correctly"""
code, out, err = self.t("list")
self.assertRegexpMatches(out, "\033\[31m.+{0}.+\033\[0m".format(self.just))
self.assertRegexpMatches(out, "\s+{0}\s+".format(self.almost))
self.assertRegex(out, "\033\[31m.+{0}.+\033\[0m".format(self.just))
self.assertRegex(out, "\s+{0}\s+".format(self.almost))
class TestBug418(TestCase):

View file

@ -65,7 +65,7 @@ class TestDuplication(TestCase):
def test_duplication_showing_uuid(self):
"""Verify duplicate can show uuid"""
code, out, err = self.t("1 duplicate rc.verbose:new-uuid")
self.assertRegexpMatches(out, "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}")
self.assertRegex(out, "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}")
class TestDuplication2(TestCase):

View file

@ -71,9 +71,9 @@ class TestUtf8(TestCase):
code, out, err = self.t("ls")
expected = re.compile("\S\s{4}abc", re.MULTILINE)
self.assertRegexpMatches(out, expected)
self.assertRegex(out, expected)
expected = re.compile("\S\s{5}def", re.MULTILINE)
self.assertRegexpMatches(out, expected)
self.assertRegex(out, expected)
if __name__ == "__main__":

View file

@ -54,19 +54,19 @@ class TestEnpassantMultiple(BaseTestEnpassant):
def validate_info(self, id, desc):
code, out, err = self.t((id, "info"))
self.assertRegexpMatches(
self.assertRegex(
out, "Status +Completed",
msg="enpassant {0} status change".format(id),
)
self.assertRegexpMatches(
self.assertRegex(
out, "Priority +H",
msg="enpassant {0} priority change".format(id),
)
self.assertRegexpMatches(
self.assertRegex(
out, "Tags +tag",
msg="enpassant {0} tag change".format(id),
)
self.assertRegexpMatches(
self.assertRegex(
out, "Description +{0}".format(desc),
msg="enpassant {0} description change".format(id),
)
@ -95,27 +95,27 @@ class TestEnpassant(BaseTestEnpassant):
def perform_action(self, action):
self.t(("1", action, "oneanno"))
code, out, err = self.t("1 info")
self.assertRegexpMatches(out, "Description +one\n[0-9: -]+ oneanno",
self.assertRegex(out, "Description +one\n[0-9: -]+ oneanno",
msg="{0} enpassant annotation".format(action))
self.t(("2", action, "/two/TWO/"))
code, out, err = self.t("2 info")
self.assertRegexpMatches(out, "Description +TWO",
self.assertRegex(out, "Description +TWO",
msg="{0} enpassant modify".format(action))
self.t(("3", action, "+threetag"))
code, out, err = self.t("3 info")
self.assertRegexpMatches(out, "Tags +threetag",
self.assertRegex(out, "Tags +threetag",
msg="{0} enpassant tag".format(action))
self.t(("4", action, "pri:H"))
code, out, err = self.t("4 info")
self.assertRegexpMatches(out, "Priority +H",
self.assertRegex(out, "Priority +H",
msg="{0} enpassant priority".format(action))
self.t(("5", action, "pro:PROJ"))
code, out, err = self.t("5 info")
self.assertRegexpMatches(out, "Project +PROJ",
self.assertRegex(out, "Project +PROJ",
msg="{0} enpassant project".format(action))
def test_done(self):

View file

@ -77,7 +77,7 @@ class TestExportCommand(TestCase):
if expected_value is not None:
if regexp:
# Match to pattern if checking with regexp
self.assertRegexpMatches(value, expected_value)
self.assertRegex(value, expected_value)
else:
# Equality match if checking with string
self.assertEqual(value, expected_value)

View file

@ -68,7 +68,7 @@ class TestFeature559(TestCase):
code, out, err = self.t.runError("rc.data.location=locationdoesnotexist list")
self.assertNotIn("footask", out)
self.assertNotIn("Error", out)
self.assertRegexpMatches(err, re.compile("Error:.+does not exist", re.DOTALL))
self.assertRegex(err, re.compile("Error:.+does not exist", re.DOTALL))
if __name__ == "__main__":

View file

@ -56,16 +56,16 @@ class TestDefaultProject(TestCase):
self.assertIn("foobar", out)
expected = "Project\s+garden"
self.assertRegexpMatches(out, expected)
self.assertRegex(out, expected)
self.t("1 modify project:")
code, out, err = self.t("1 info")
self.assertIn("foobar", out)
self.assertNotRegexpMatches(out, expected)
self.assertNotRegex(out, expected)
notexpected = "Project\s+" + self.default_project
self.assertNotRegexpMatches(out, notexpected)
self.assertNotRegex(out, notexpected)
def test_without_project(self):
"""default.project applied when no project is specified"""
@ -77,7 +77,7 @@ class TestDefaultProject(TestCase):
self.assertIn("foobar", out)
expected = "Project\s+" + self.default_project
self.assertRegexpMatches(out, expected)
self.assertRegex(out, expected)
def test_default_project_inline_override(self):
"""no project applied when default.project is overridden"""
@ -125,7 +125,7 @@ class TestDefaultProject(TestCase):
code, out, err = self.t("1 info")
expected = "Description\s+foobar\n[0-9-: ]+ Hello"
self.assertRegexpMatches(out, expected)
self.assertRegex(out, expected)
self.assertNotIn("Project", out)
def test_time_default_project(self):
@ -158,7 +158,7 @@ class TestDefaultProject(TestCase):
code, out, err = self.t("1 info")
self.assertIn(DESC, out)
self.assertRegexpMatches(out, "Status\s+Recurring") # is a parent task
self.assertRegex(out, "Status\s+Recurring") # is a parent task
self.assertIn(self.default_project, out)
self.t.faketime("+1d")

View file

@ -62,8 +62,8 @@ class TestRecurrenceProblems(TestCase):
self.t("add foo due:today recur:yearly until:eom")
code, out, err = self.t("info 1")
self.assertNotRegexpMatches(out, "Until\s+\d{10}")
self.assertRegexpMatches(out, "Until\s+\d+\/\d+\/\d{4}")
self.assertNotRegex(out, "Until\s+\d{10}")
self.assertRegex(out, "Until\s+\d+\/\d+\/\d{4}")
if __name__ == "__main__":

View file

@ -69,20 +69,20 @@ class TestCountdown(TestCase):
self.t.config("report.up.sort", "due+")
code, out, err = self.t("up")
self.assertRegexpMatches(out, " one\n.+ two\n")
self.assertRegexpMatches(out, " two\n.+ three\n")
self.assertRegexpMatches(out, " three\n.+ four\n")
self.assertRegexpMatches(out, " four\n.+ five\n")
self.assertRegexpMatches(out, " five\n.+ six\n")
self.assertRegexpMatches(out, " six\n.+ seven\n")
self.assertRegexpMatches(out, " seven\n.+ eight\n")
self.assertRegexpMatches(out, " eight\n.+ nine\n")
self.assertRegexpMatches(out, " nine\n.+ ten\n")
self.assertRegexpMatches(out, " ten\n.+ eleven\n")
self.assertRegexpMatches(out, " eleven\n.+ twelve\n")
self.assertRegexpMatches(out, " twelve\n.+ thirteen\n")
self.assertRegexpMatches(out, " thirteen\n.+ fourteen\n")
self.assertRegexpMatches(out, " fourteen\n.+ fifteen\n")
self.assertRegex(out, " one\n.+ two\n")
self.assertRegex(out, " two\n.+ three\n")
self.assertRegex(out, " three\n.+ four\n")
self.assertRegex(out, " four\n.+ five\n")
self.assertRegex(out, " five\n.+ six\n")
self.assertRegex(out, " six\n.+ seven\n")
self.assertRegex(out, " seven\n.+ eight\n")
self.assertRegex(out, " eight\n.+ nine\n")
self.assertRegex(out, " nine\n.+ ten\n")
self.assertRegex(out, " ten\n.+ eleven\n")
self.assertRegex(out, " eleven\n.+ twelve\n")
self.assertRegex(out, " twelve\n.+ thirteen\n")
self.assertRegex(out, " thirteen\n.+ fourteen\n")
self.assertRegex(out, " fourteen\n.+ fifteen\n")
def test_countdown_down(self):
"""Verify countdown sorting: descending"""
@ -93,20 +93,20 @@ class TestCountdown(TestCase):
self.t.config("report.down.sort", "due-")
code, out, err = self.t("down")
self.assertRegexpMatches(out, " fifteen\n.+ fourteen\n")
self.assertRegexpMatches(out, " fourteen\n.+ thirteen\n")
self.assertRegexpMatches(out, " thirteen\n.+ twelve\n")
self.assertRegexpMatches(out, " twelve\n.+ eleven\n")
self.assertRegexpMatches(out, " eleven\n.+ ten\n")
self.assertRegexpMatches(out, " ten\n.+ nine\n")
self.assertRegexpMatches(out, " nine\n.+ eight\n")
self.assertRegexpMatches(out, " eight\n.+ seven\n")
self.assertRegexpMatches(out, " seven\n.+ six\n")
self.assertRegexpMatches(out, " six\n.+ five\n")
self.assertRegexpMatches(out, " five\n.+ four\n")
self.assertRegexpMatches(out, " four\n.+ three\n")
self.assertRegexpMatches(out, " three\n.+ two\n")
self.assertRegexpMatches(out, " two\n.+ one\n")
self.assertRegex(out, " fifteen\n.+ fourteen\n")
self.assertRegex(out, " fourteen\n.+ thirteen\n")
self.assertRegex(out, " thirteen\n.+ twelve\n")
self.assertRegex(out, " twelve\n.+ eleven\n")
self.assertRegex(out, " eleven\n.+ ten\n")
self.assertRegex(out, " ten\n.+ nine\n")
self.assertRegex(out, " nine\n.+ eight\n")
self.assertRegex(out, " eight\n.+ seven\n")
self.assertRegex(out, " seven\n.+ six\n")
self.assertRegex(out, " six\n.+ five\n")
self.assertRegex(out, " five\n.+ four\n")
self.assertRegex(out, " four\n.+ three\n")
self.assertRegex(out, " three\n.+ two\n")
self.assertRegex(out, " two\n.+ one\n")
class TestFormatDepends(TestCase):
@ -118,12 +118,12 @@ class TestFormatDepends(TestCase):
def test_depends_default(self):
self.t.config("report.formatdep.columns", "description,depends")
code, out, err = self.t("formatdep")
self.assertRegexpMatches(out, "one\s+1")
self.assertRegex(out, "one\s+1")
def test_depends_count(self):
self.t.config("report.formatdep.columns", "description,depends.count")
code, out, err = self.t("formatdep")
self.assertRegexpMatches(out, "one\s+\[1\]")
self.assertRegex(out, "one\s+\[1\]")
class TestBug101(TestCase):

View file

@ -50,7 +50,7 @@ class TestGC(TestCase):
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")
self.assertRegex(out, "1\s+one", "should still have ID")
def test_gc_off_mod(self):
"""mod by ID after done with gc off"""
@ -59,7 +59,7 @@ class TestGC(TestCase):
self.t("gctest")
self.t("2 mod +TWO")
code, out, err = self.t("gctest")
self.assertRegexpMatches(out, "2\s+two\s+TWO", "modified 'two'")
self.assertRegex(out, "2\s+two\s+TWO", "modified 'two'")
def test_gc_on_id(self):
"""IDs reshuffle after report when GC on"""
@ -67,8 +67,8 @@ class TestGC(TestCase):
self.t("1 done")
self.t("2 mod +TWO")
code, out, err = self.t("gctest")
self.assertRegexpMatches(out, "1\s+two\s+TWO")
self.assertRegexpMatches(out, "2\s+three")
self.assertRegex(out, "1\s+two\s+TWO")
self.assertRegex(out, "2\s+three")
if __name__ == "__main__":

View file

@ -120,13 +120,13 @@ class TestBug956(TestCase):
def test_uuids_header(self):
"""956: Verify 'uuids' does not print a header"""
code, out, err = self.t("rc.verbose:nothing uuids")
self.assertRegexpMatches(out, "[0-9a-f-]*\n")
self.assertRegex(out, "[0-9a-f-]*\n")
self.assertNotIn("TASKRC", out)
def test_uuids_helper_header(self):
"""956: Verify '_uuids' does not print a header"""
code, out, err = self.t("rc.verbose:nothing _uuids")
self.assertRegexpMatches(out, "[0-9a-f-]*\n")
self.assertRegex(out, "[0-9a-f-]*\n")
self.assertNotIn("TASKRC", out)

View file

@ -55,17 +55,17 @@ class TestHistoryDaily(TestCase):
def test_history_daily(self):
"""Verify 'history.daily' correctly categorizes data"""
code, out, err = self.t("history.daily")
self.assertRegexpMatches(out, "7\s+1\s+0\s+6")
self.assertRegexpMatches(out, "2\s+3\s+3\s+-4")
self.assertRegexpMatches(out, "4\s+2\s+1\s+1")
self.assertRegex(out, "7\s+1\s+0\s+6")
self.assertRegex(out, "2\s+3\s+3\s+-4")
self.assertRegex(out, "4\s+2\s+1\s+1")
code, out, err = self.t("ghistory.daily rc._forcecolor:on")
self.assertRegexpMatches(out, "\s7.+\s1.+")
self.assertRegexpMatches(out, "\s2.+\s3.+\s3.+")
self.assertRegex(out, "\s7.+\s1.+")
self.assertRegex(out, "\s2.+\s3.+\s3.+")
code, out, err = self.t("ghistory.daily")
self.assertRegexpMatches(out, "2015\s+January\s+2\s+\++X+\s")
self.assertRegexpMatches(out, "\s+February\s+2\s+\++X+\-+")
self.assertRegex(out, "2015\s+January\s+2\s+\++X+\s")
self.assertRegex(out, "\s+February\s+2\s+\++X+\-+")
class TestHistoryWeekly(TestCase):
def setUp(self):
@ -88,17 +88,17 @@ class TestHistoryWeekly(TestCase):
def test_history_weekly(self):
"""Verify 'history.weekly' correctly categorizes data"""
code, out, err = self.t("history.weekly")
self.assertRegexpMatches(out, "7\s+1\s+0\s+6")
self.assertRegexpMatches(out, "2\s+3\s+3\s+-4")
self.assertRegexpMatches(out, "4\s+2\s+1\s+1")
self.assertRegex(out, "7\s+1\s+0\s+6")
self.assertRegex(out, "2\s+3\s+3\s+-4")
self.assertRegex(out, "4\s+2\s+1\s+1")
code, out, err = self.t("ghistory.weekly rc._forcecolor:on")
self.assertRegexpMatches(out, "\s7.+\s1.+")
self.assertRegexpMatches(out, "\s2.+\s3.+\s3.+")
self.assertRegex(out, "\s7.+\s1.+")
self.assertRegex(out, "\s2.+\s3.+\s3.+")
code, out, err = self.t("ghistory.weekly")
self.assertRegexpMatches(out, "2014\s+December\s+28\s+\++X+\s")
self.assertRegexpMatches(out, "2015\s+February\s+1\s+\++X+\-+")
self.assertRegex(out, "2014\s+December\s+28\s+\++X+\s")
self.assertRegex(out, "2015\s+February\s+1\s+\++X+\-+")
class TestHistoryMonthly(TestCase):
@ -122,17 +122,17 @@ class TestHistoryMonthly(TestCase):
def test_history_monthly(self):
"""Verify 'history.monthly' correctly categorizes data"""
code, out, err = self.t("history.monthly")
self.assertRegexpMatches(out, "7\s+1\s+0\s+6")
self.assertRegexpMatches(out, "2\s+3\s+3\s+-4")
self.assertRegexpMatches(out, "4\s+2\s+1\s+1")
self.assertRegex(out, "7\s+1\s+0\s+6")
self.assertRegex(out, "2\s+3\s+3\s+-4")
self.assertRegex(out, "4\s+2\s+1\s+1")
code, out, err = self.t("ghistory.monthly rc._forcecolor:on")
self.assertRegexpMatches(out, "\s7.+\s1.+")
self.assertRegexpMatches(out, "\s2.+\s3.+\s3.+")
self.assertRegex(out, "\s7.+\s1.+")
self.assertRegex(out, "\s2.+\s3.+\s3.+")
code, out, err = self.t("ghistory.monthly")
self.assertRegexpMatches(out, "2015\s+January\s+\++X+\s")
self.assertRegexpMatches(out, "\s+February\s+\++X+\-+")
self.assertRegex(out, "2015\s+January\s+\++X+\s")
self.assertRegex(out, "\s+February\s+\++X+\-+")
class TestHistoryAnnual(TestCase):
@ -160,17 +160,17 @@ class TestHistoryAnnual(TestCase):
def test_history_annual(self):
"""Verify 'history.annual' correctly categorizes data"""
code, out, err = self.t("history.annual")
self.assertRegexpMatches(out, "7\s+1\s+0\s+6")
self.assertRegexpMatches(out, "2\s+3\s+3\s+-4")
self.assertRegexpMatches(out, "4\s+2\s+1\s+1")
self.assertRegex(out, "7\s+1\s+0\s+6")
self.assertRegex(out, "2\s+3\s+3\s+-4")
self.assertRegex(out, "4\s+2\s+1\s+1")
code, out, err = self.t("ghistory.annual rc._forcecolor:on")
self.assertRegexpMatches(out, "\s7.+\s1.+")
self.assertRegexpMatches(out, "\s2.+\s3.+\s3.+")
self.assertRegex(out, "\s7.+\s1.+")
self.assertRegex(out, "\s2.+\s3.+\s3.+")
code, out, err = self.t("ghistory.annual")
self.assertRegexpMatches(out, "2014\s+\++X+\s")
self.assertRegexpMatches(out, "2015\s+\++X+\-+")
self.assertRegex(out, "2014\s+\++X+\s")
self.assertRegex(out, "2015\s+\++X+\-+")
if __name__ == "__main__":
from simpletap import TAPTestRunner

View file

@ -68,7 +68,7 @@ class TestHooksOnLaunch(TestCase):
self.t.hooks.add_default(hookname, log=True)
code, out, err = self.t("diagnostics")
self.assertRegexpMatches(out, r"on-launch-good-env\s+\(executable\)")
self.assertRegex(out, r"on-launch-good-env\s+\(executable\)")
def test_onlaunch_builtin_env_debug(self):
"""Verify that 'debug.hooks' shows hook details"""

View file

@ -50,42 +50,42 @@ class TestIDs(TestCase):
def test_ids_count_A(self):
"""ids +A"""
code, out, err = self.t("ids +A")
self.assertRegexpMatches(out, "^1-3 5$")
self.assertRegex(out, "^1-3 5$")
def test_ids_count_B(self):
"""ids +B"""
code, out, err = self.t("ids +B")
self.assertRegexpMatches(out, "^1 3 5$")
self.assertRegex(out, "^1 3 5$")
def test_ids_count_A_B(self):
"""ids +A -B"""
code, out, err = self.t("ids +A -B")
self.assertRegexpMatches(out, "^2$")
self.assertRegex(out, "^2$")
def test_get_ids_count_A(self):
"""_ids +A"""
code, out, err = self.t("_ids +A")
self.assertRegexpMatches(out, "^1\n2\n3\n5$")
self.assertRegex(out, "^1\n2\n3\n5$")
def test_get_zshids_count_A(self):
"""_zshids +A"""
code, out, err = self.t("_zshids +A")
self.assertRegexpMatches(out, "^1:one\n2:two\n3:three\n5:five$")
self.assertRegex(out, "^1:one\n2:two\n3:three\n5:five$")
def test_uuids_count_A(self):
"""uuids +A"""
code, out, err = self.t("uuids +A")
self.assertRegexpMatches(out, "{0} {0} {0} {0}".format(UUID_REGEXP))
self.assertRegex(out, "{0} {0} {0} {0}".format(UUID_REGEXP))
def test_get_uuids_count_A(self):
"""_uuids +A"""
code, out, err = self.t("_uuids +A")
self.assertRegexpMatches(out, "{0}\n{0}\n{0}\n{0}".format(UUID_REGEXP))
self.assertRegex(out, "{0}\n{0}\n{0}\n{0}".format(UUID_REGEXP))
def test_get_zshuuids_count_A(self):
"""_zshuuids +A"""
code, out, err = self.t("_zshuuids +A")
self.assertRegexpMatches(
self.assertRegex(
out, "{0}:one\n{0}:two\n{0}:three\n{0}:five".format(UUID_REGEXP))
def test_ids_ranges(self):

View file

@ -79,19 +79,19 @@ class TestImport(TestCase):
def assertData1(self):
code, out, err = self.t("list")
self.assertRegexpMatches(out, "1.+A.+zero")
self.assertRegexpMatches(out, "2.+B.+one")
self.assertRegex(out, "1.+A.+zero")
self.assertRegex(out, "2.+B.+one")
self.assertNotIn("two", out)
code, out, err = self.t("completed")
self.assertNotIn("zero", out)
self.assertNotIn("one", out)
# complete has completion date as 1st column
self.assertRegexpMatches(out, "2/13/2009.+two")
self.assertRegex(out, "2/13/2009.+two")
def assertData2(self):
code, out, err = self.t("list")
self.assertRegexpMatches(out, "3.+three")
self.assertRegex(out, "3.+three")
def assertData3(self):
code, out, err = self.t("list")

View file

@ -64,21 +64,21 @@ class TestInfoCommand(TestCase):
self.t("1 annotate bar", input="n\n")
code, out, err = self.t("1 info")
self.assertRegexpMatches(out, "ID\s+1")
self.assertRegexpMatches(out, "Description\s+foo")
self.assertRegexpMatches(out, "\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\s+bar")
self.assertRegexpMatches(out, "Status\s+Recurring")
self.assertRegexpMatches(out, "Project\s+P")
self.assertRegexpMatches(out, "Recurrence\s+P1M")
self.assertRegexpMatches(out, "Entered\s+\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}")
self.assertRegexpMatches(out, "Waiting until\s+\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}")
self.assertRegexpMatches(out, "Scheduled\s+\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}")
self.assertRegexpMatches(out, "Start\s+\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}")
self.assertRegexpMatches(out, "Due\s+\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}")
self.assertRegexpMatches(out, "Until\s+\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}")
self.assertRegexpMatches(out, "Last modified\s+\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}")
self.assertRegex(out, "ID\s+1")
self.assertRegex(out, "Description\s+foo")
self.assertRegex(out, "\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\s+bar")
self.assertRegex(out, "Status\s+Recurring")
self.assertRegex(out, "Project\s+P")
self.assertRegex(out, "Recurrence\s+P1M")
self.assertRegex(out, "Entered\s+\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}")
self.assertRegex(out, "Waiting until\s+\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}")
self.assertRegex(out, "Scheduled\s+\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}")
self.assertRegex(out, "Start\s+\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}")
self.assertRegex(out, "Due\s+\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}")
self.assertRegex(out, "Until\s+\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}")
self.assertRegex(out, "Last modified\s+\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}")
self.assertRegexpMatches(out, "Tags\s+tag")
self.assertRegex(out, "Tags\s+tag")
self.assertIn("ACTIVE", out)
self.assertIn("ANNOTATED", out)
self.assertIn("MONTH", out)
@ -89,11 +89,11 @@ class TestInfoCommand(TestCase):
self.assertIn("YEAR", out)
self.assertIn("UDA", out)
self.assertRegexpMatches(out, "UUID\s+[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}")
self.assertRegexpMatches(out, "Urgency\s+\d+(\.\d+)?")
self.assertRegexpMatches(out, "Priority\s+H")
self.assertRegex(out, "UUID\s+[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}")
self.assertRegex(out, "Urgency\s+\d+(\.\d+)?")
self.assertRegex(out, "Priority\s+H")
self.assertRegexpMatches(out, "Annotation of 'bar' added.")
self.assertRegex(out, "Annotation of 'bar' added.")
self.assertIn("project", out)
self.assertIn("active", out)
self.assertIn("annotations", out)
@ -113,7 +113,7 @@ class TestBug425(TestCase):
self.t("1 modify Bar in Bar")
code, out, err = self.t("1 ls")
self.assertRegexpMatches(out, "1\s+Bar in Bar")
self.assertRegex(out, "1\s+Bar in Bar")
if __name__ == "__main__":

View file

@ -43,7 +43,7 @@ class TestLogoCommand(TestCase):
def test_logo_command(self):
"""Check that there are colors. For coverage"""
code, out, err = self.t("logo rc._forcecolor:on")
self.assertRegexpMatches(out, ".\[48;5;\d+m .\[0m")
self.assertRegex(out, ".\[48;5;\d+m .\[0m")
def test_logo_command_no_color(self):
"""Check that it only works with color. For coverage"""

View file

@ -53,39 +53,39 @@ class TestProjects(TestCase):
code, out, err = self.t("project:B projects")
expected = "1 project \(1 task\)"
self.assertRegexpMatches(out, expected)
self.assertRegex(out, expected)
def test_project_progress(self):
"""project status/progress is shown and is up-to-date"""
code, out, err = self.t("add one pro:foo")
self.assertRegexpMatches(err, self.STATUS.format("foo", "0%",
self.assertRegex(err, self.STATUS.format("foo", "0%",
"1 task"))
code, out, err = self.t("add two pro:foo")
self.assertRegexpMatches(err, self.STATUS.format("foo", "0%",
self.assertRegex(err, self.STATUS.format("foo", "0%",
"2 of 2 tasks"))
code, out, err = self.t("add three pro:foo")
self.assertRegexpMatches(err, self.STATUS.format("foo", "0%",
self.assertRegex(err, self.STATUS.format("foo", "0%",
"3 of 3 tasks"))
code, out, err = self.t("add four pro:foo")
self.assertRegexpMatches(err, self.STATUS.format("foo", "0%",
self.assertRegex(err, self.STATUS.format("foo", "0%",
"4 of 4 tasks"))
code, out, err = self.t("1 done")
self.assertRegexpMatches(err, self.STATUS.format("foo", "25%",
self.assertRegex(err, self.STATUS.format("foo", "25%",
"3 of 4 tasks"))
code, out, err = self.t("2 delete", input="y\n")
self.assertRegexpMatches(err, self.STATUS.format("foo", "33%",
self.assertRegex(err, self.STATUS.format("foo", "33%",
"2 of 3 tasks"))
code, out, err = self.t("3 modify pro:bar")
self.assertRegexpMatches(err, self.STATUS.format("foo", "50%",
self.assertRegex(err, self.STATUS.format("foo", "50%",
"1 of 2 tasks"))
self.assertRegexpMatches(err, self.STATUS.format("bar", "0%",
self.assertRegex(err, self.STATUS.format("bar", "0%",
"1 task"))
def test_project_spaces(self):
@ -93,7 +93,7 @@ class TestProjects(TestCase):
self.t("add hello pro:bob")
code, out, err = self.t('1 mod pro:"foo bar"')
self.assertRegexpMatches(err, self.STATUS.format("foo bar", "0%",
self.assertRegex(err, self.STATUS.format("foo bar", "0%",
"1 task"))
def add_tasks(self):
@ -184,25 +184,25 @@ class TestSubprojects(TestCase):
def test_project_exact1(self):
"""Verify single character exact"""
code, out, err = self.t("list project:b")
self.assertRegexpMatches(out, r"\bb\s")
self.assertRegex(out, r"\bb\s")
def test_project_top1(self):
"""Verify single character parent"""
code, out, err = self.t("list project:a")
self.assertRegexpMatches(out, r"\babc\s")
self.assertRegexpMatches(out, r"\bab\s")
self.assertRegexpMatches(out, r"\ba\s")
self.assertRegex(out, r"\babc\s")
self.assertRegex(out, r"\bab\s")
self.assertRegex(out, r"\ba\s")
def test_project_top2(self):
"""Verify double character parent"""
code, out, err = self.t("list project:ab")
self.assertRegexpMatches(out, r"\babc\s")
self.assertRegexpMatches(out, r"\bab\s")
self.assertRegex(out, r"\babc\s")
self.assertRegex(out, r"\bab\s")
def test_project_exact3(self):
"""Verify triple character exact"""
code, out, err = self.t("list project:abc")
self.assertRegexpMatches(out, r"\babc\s")
self.assertRegex(out, r"\babc\s")
def test_project_mismatch4(self):
"""Verify quad character mismatch"""
@ -227,13 +227,13 @@ class TestBug299(TestCase):
"""
code, out, err = self.t("list project.isnt:one pro.isnt:two")
self.assertNotRegexpMatches(out, "one.*foo")
self.assertRegexpMatches(out, "ones.*faz")
self.assertRegexpMatches(out, "phone.*boo")
self.assertRegexpMatches(out, "bones.*too")
self.assertNotRegex(out, "one.*foo")
self.assertRegex(out, "ones.*faz")
self.assertRegex(out, "phone.*boo")
self.assertRegex(out, "bones.*too")
self.assertNotRegexpMatches(out, "two.*bar")
self.assertRegexpMatches(out, "three.*baz")
self.assertNotRegex(out, "two.*bar")
self.assertRegex(out, "three.*baz")
def test_project_exclusion_hasnt(self):
"""299: check project exclusion using project.hasnt:<name>
@ -242,13 +242,13 @@ class TestBug299(TestCase):
"""
code, out, err = self.t("list project.hasnt:one pro.hasnt:two")
self.assertNotRegexpMatches(out, "one.*foo")
self.assertNotRegexpMatches(out, "ones.*faz")
self.assertNotRegexpMatches(out, "phone.*boo")
self.assertNotRegexpMatches(out, "bones.*too")
self.assertNotRegex(out, "one.*foo")
self.assertNotRegex(out, "ones.*faz")
self.assertNotRegex(out, "phone.*boo")
self.assertNotRegex(out, "bones.*too")
self.assertNotRegexpMatches(out, "two.*bar")
self.assertRegexpMatches(out, "three.*baz")
self.assertNotRegex(out, "two.*bar")
self.assertRegex(out, "three.*baz")
class TestBug605(TestCase):
@ -386,16 +386,16 @@ class TestBug899(TestCase):
def test_log_project(self):
"""899: Verify task log behaves correctly when logging into a project"""
code, out, err = self.t("add one pro:A")
self.assertRegexpMatches(err, " 0% complete \(1 task ")
self.assertRegex(err, " 0% complete \(1 task ")
code, out, err = self.t("add two pro:A")
self.assertRegexpMatches(err, " 0% complete \(2 of 2 ")
self.assertRegex(err, " 0% complete \(2 of 2 ")
code, out, err = self.t("1 done")
self.assertRegexpMatches(err, " 50% complete \(1 of 2 ")
self.assertRegex(err, " 50% complete \(1 of 2 ")
code, out, err = self.t("log three pro:A")
self.assertRegexpMatches(err, " 66% complete \(1 of 3 ")
self.assertRegex(err, " 66% complete \(1 of 3 ")
class TestBug1267(TestCase):

View file

@ -46,10 +46,10 @@ class TestOverride(TestCase):
def test_override(self):
"""Verify override is displayed in 'show' command"""
code, out, err = self.t("show regex")
self.assertRegexpMatches(out, r"regex +0")
self.assertRegex(out, r"regex +0")
code, out, err = self.t("rc.regex:1 show regex")
self.assertRegexpMatches(out, r"regex +1")
self.assertRegex(out, r"regex +1")
class TestRCSegfault(TestCase):

View file

@ -58,12 +58,12 @@ class TestRecurrenceSorting(TestCase):
def test_sort_ascending(self):
"""Verify sorting by 'recur+' is correct"""
code, out, err = self.t("asc rc.verbose:nothing")
self.assertRegexpMatches(out, "4\s+P1D\s+one\s+6\s+P3D\s+three\s+5\s+P7D\s+two")
self.assertRegex(out, "4\s+P1D\s+one\s+6\s+P3D\s+three\s+5\s+P7D\s+two")
def test_sort_descending(self):
"""Verify sorting by 'recur-' is correct"""
code, out, err = self.t("desc rc.verbose:nothing")
self.assertRegexpMatches(out, "5\s+P7D\s+two\s+6\s+P3D\s+three\s+4\s+P1D\s+one")
self.assertRegex(out, "5\s+P7D\s+two\s+6\s+P3D\s+three\s+4\s+P1D\s+one")
class TestRecurrenceDisabled(TestCase):
@ -177,9 +177,9 @@ class TestRecurrenceTasks(TestCase):
# 3 complex
# 4 complex
code, out, err = self.t("minimal rc.verbose:nothing")
self.assertRegexpMatches(out, "1\s+simple")
self.assertRegexpMatches(out, "3\s+complex")
self.assertRegexpMatches(out, "4\s+complex")
self.assertRegex(out, "1\s+simple")
self.assertRegex(out, "3\s+complex")
self.assertRegex(out, "4\s+complex")
# Modify a child task and do not propagate the change.
self.t("3 modify complex2", input="n\n")
@ -316,7 +316,7 @@ class TestBug955(TestCase):
self.t("add foo due:now recur:1day")
code, out, err = self.t("ls")
self.assertRegexpMatches(out, re.compile("^2 tasks", re.MULTILINE))
self.assertRegex(out, re.compile("^2 tasks", re.MULTILINE))
def test_no_prompt_for_parent_on_child_delete_confirmation_off(self):
"""955: Deleting a child of a recurring task prompts for parent deletion (confirmation:off)
@ -332,7 +332,7 @@ class TestBug955(TestCase):
# 1 task remains.
code, out, err = self.t("ls")
self.assertRegexpMatches(out, re.compile("^1 task", re.MULTILINE))
self.assertRegex(out, re.compile("^1 task", re.MULTILINE))
code, out, err = self.t("2 delete", input="y\ny\n")
self.assertIn("Deleting task 2", out)
@ -357,7 +357,7 @@ class TestBug955(TestCase):
# 2 tasks intact.
code, out, err = self.t("ls")
self.assertRegexpMatches(out, re.compile("^2 tasks", re.MULTILINE))
self.assertRegex(out, re.compile("^2 tasks", re.MULTILINE))
code, out, err = self.t("2 delete", input="y\ny\n")
self.assertIn("Deleted 2 tasks", out)

View file

@ -58,7 +58,7 @@ class TestSequences(TestCase):
"""Test sequences in start/stop"""
self.t("1,2 start")
code, out, err = self.t("_get 1.start 2.start")
self.assertRegexpMatches(out, "\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2} \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\n")
self.assertRegex(out, "\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2} \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\n")
self.t("1,2 stop")
code, out, err = self.t("_get 1.start 2.start")

View file

@ -56,7 +56,7 @@ class MetaTestSorting(MetaTest):
for expected in expectations:
regex = re.compile(expected, re.DOTALL)
self.assertRegexpMatches(out, regex)
self.assertRegex(out, regex)
# Title of test in report
test.__doc__ = "{0} sort:{1}".format(classname, _filter)
@ -261,7 +261,7 @@ class TestSortNone(TestCase):
code, out, err = self.t("_get 1.uuid 2.uuid 3.uuid")
uuid1, uuid2, uuid3 = out.strip().split(' ')
code, out, err = self.t("%s %s %s list rc.report.list.sort:none rc.report.list.columns:id,description rc.report.list.labels:id,desc" % (uuid2, uuid3, uuid1))
self.assertRegexpMatches(out, ' 2 two\n 3 three\n 1 one')
self.assertRegex(out, ' 2 two\n 3 three\n 1 one')
if __name__ == "__main__":

View file

@ -51,7 +51,7 @@ class TestSpecialTags(TestCase):
def test_nocolor(self):
self.t("add should have no red +nocolor priority:H")
code, out, err = self.t("ls")
self.assertRegexpMatches(out, r"\s1\s+nocolor\s+should have no red")
self.assertRegex(out, r"\s1\s+nocolor\s+should have no red")
def test_nonag(self):
self.t("add should be red +nonag")

View file

@ -48,13 +48,13 @@ class TestStatisticsCommand(TestCase):
self.t("log three")
code, out, err = self.t("stats")
self.assertRegexpMatches(out, "Pending\s+1\n")
self.assertRegexpMatches(out, "Completed\s+1\n")
self.assertRegexpMatches(out, "Deleted\s+1\n")
self.assertRegexpMatches(out, "Total\s+3\n")
self.assertRegex(out, "Pending\s+1\n")
self.assertRegex(out, "Completed\s+1\n")
self.assertRegex(out, "Deleted\s+1\n")
self.assertRegex(out, "Total\s+3\n")
code, out, err = self.t("stats rc._forcecolor:on")
self.assertRegexpMatches(out, "Pending\s+1\n")
self.assertRegex(out, "Pending\s+1\n")
if __name__ == "__main__":

View file

@ -51,8 +51,8 @@ from basetest import Taskd, ServerTestCase
# self.assertIsInstance(a, b)
# self.assertNotIsInstance(a, b)
# self.assertRaises(e)
# self.assertRegexpMatches(t, r)
# self.assertNotRegexpMatches(t, r)
# self.assertRegex(t, r)
# self.assertNotRegex(t, r)
# self.tap("")
class TestBugNumber(TestCase):
@ -74,7 +74,7 @@ class TestBugNumber(TestCase):
code, out, err = self.t("version")
expected = "Copyright \(C\) \d{4} - %d" % (datetime.now().year,)
self.assertRegexpMatches(out.decode("utf8"), expected)
self.assertRegex(out.decode("utf8"), expected)
# TAP diagnostics on the bas
self.tap("Yay TAP diagnostics")

View file

@ -78,7 +78,7 @@ class TestTimesheet(TestCase):
"Started.+PS2.+Completed.+C2.+"
"Started.+PS1.+Completed.+C1.+"
"Started.+PS0.+Completed.+C0", re.DOTALL)
self.assertRegexpMatches(out, expected)
self.assertRegex(out, expected)
def test_one_week(self):
"""One week of started and completed"""
@ -86,7 +86,7 @@ class TestTimesheet(TestCase):
code, out, err = self.t("timesheet (+PENDING and start.after:now-1wk) or (+COMPLETED and end.after:now-1wk)")
expected = re.compile("Started.+PS0.+Completed.+C0", re.DOTALL)
self.assertRegexpMatches(out, expected)
self.assertRegex(out, expected)
self.assertNotIn("PS1", out)
self.assertNotIn("PS2", out)
self.assertNotIn("C1", out)

View file

@ -60,7 +60,7 @@ class TestBug1379(TestCase):
self.t("add dep:1 Blocked")
code, out, err = self.t("all +BLOCKED")
self.assertRegexpMatches(out, self.RED + r".*Blocked.*" + self.CLEAR)
self.assertRegex(out, self.RED + r".*Blocked.*" + self.CLEAR)
def test_color_UNBLOCKED(self):
"""color.tag.UNBLOCKED changes color of UNBLOCKED tasks"""
@ -70,7 +70,7 @@ class TestBug1379(TestCase):
self.t("add dep:1 Blocked")
code, out, err = self.t("all +UNBLOCKED")
self.assertRegexpMatches(out, self.RED + r".*Blocks.*" + self.CLEAR)
self.assertRegex(out, self.RED + r".*Blocks.*" + self.CLEAR)
def test_color_BLOCKING(self):
"""color.tag.BLOCKING changes color of BLOCKING tasks"""
@ -80,7 +80,7 @@ class TestBug1379(TestCase):
self.t("add dep:1 Blocked")
code, out, err = self.t("all +BLOCKING")
self.assertRegexpMatches(out, self.RED + r".*Blocks.*" + self.CLEAR)
self.assertRegex(out, self.RED + r".*Blocks.*" + self.CLEAR)
def test_color_SCHEDULED(self):
"""color.tag.SCHEDULED changes color of SCHEDULED tasks"""
@ -89,7 +89,7 @@ class TestBug1379(TestCase):
self.t("add scheduled:tomorrow Have fun")
code, out, err = self.t("all +SCHEDULED")
self.assertRegexpMatches(out, self.RED + r".*Have fun.*" + self.CLEAR)
self.assertRegex(out, self.RED + r".*Have fun.*" + self.CLEAR)
def test_color_UNTIL(self):
"""color.tag.UNTIL changes color of UNTIL tasks"""
@ -98,7 +98,7 @@ class TestBug1379(TestCase):
self.t("add until:tomorrow Urgent")
code, out, err = self.t("all +UNTIL")
self.assertRegexpMatches(out, self.RED + r".*Urgent.*" + self.CLEAR)
self.assertRegex(out, self.RED + r".*Urgent.*" + self.CLEAR)
def test_color_WAITING(self):
"""color.tag.WAITING changes color of WAITING tasks"""
@ -107,7 +107,7 @@ class TestBug1379(TestCase):
self.t("add wait:tomorrow Tomorrow")
code, out, err = self.t("all +WAITING")
self.assertRegexpMatches(out, self.RED + r".*Tomorrow.*" + self.CLEAR)
self.assertRegex(out, self.RED + r".*Tomorrow.*" + self.CLEAR)
def test_color_PARENT(self):
"""color.tag.PARENT changes color of PARENT tasks"""
@ -116,7 +116,7 @@ class TestBug1379(TestCase):
self.t("add recur:daily due:tomorrow Email")
code, out, err = self.t("all +PARENT")
self.assertRegexpMatches(out, self.RED + r".*Email.*" + self.CLEAR)
self.assertRegex(out, self.RED + r".*Email.*" + self.CLEAR)
def test_color_CHILD(self):
"""color.tag.CHILD changes color of CHILD tasks"""
@ -125,7 +125,7 @@ class TestBug1379(TestCase):
self.t("add recur:daily due:tomorrow Email")
code, out, err = self.t("all +CHILD")
self.assertRegexpMatches(out, self.RED + r".*Email.*" + self.CLEAR)
self.assertRegex(out, self.RED + r".*Email.*" + self.CLEAR)
def test_color_PENDING(self):
"""color.tag.PENDING changes color of PENDING tasks"""
@ -134,7 +134,7 @@ class TestBug1379(TestCase):
self.t("add Pending")
code, out, err = self.t("all +PENDING")
self.assertRegexpMatches(out, self.RED + r".*Pending.*" + self.CLEAR)
self.assertRegex(out, self.RED + r".*Pending.*" + self.CLEAR)
def test_color_COMPLETED(self):
"""color.tag.COMPLETED changes color of COMPLETED tasks"""
@ -145,7 +145,7 @@ class TestBug1379(TestCase):
self.t("1 done")
code, out, err = self.t("all +COMPLETED")
self.assertRegexpMatches(out, self.RED + r".*Complete.*" + self.CLEAR)
self.assertRegex(out, self.RED + r".*Complete.*" + self.CLEAR)
def test_color_DELETED(self):
"""color.tag.DELETED changes color of DELETED tasks"""
@ -156,7 +156,7 @@ class TestBug1379(TestCase):
self.t("1 delete", input="y\n")
code, out, err = self.t("all +DELETED")
self.assertRegexpMatches(out, self.RED + r".*Delete.*" + self.CLEAR)
self.assertRegex(out, self.RED + r".*Delete.*" + self.CLEAR)
if __name__ == "__main__":
from simpletap import TAPTestRunner

View file

@ -47,8 +47,8 @@ from basetest import Task, TestCase
# self.assertIsInstance(a, b)
# self.assertNotIsInstance(a, b)
# self.assertRaises(e)
# self.assertRegexpMatches(t, r)
# self.assertNotRegexpMatches(t, r)
# self.assertRegex(t, r)
# self.assertNotRegex(t, r)
# self.tap("")
class TestBug1837(TestCase):

View file

@ -103,8 +103,8 @@ class TestUdaDate(TestBaseUda):
self.assertIn("Created task", out)
code, out, err = self.t("uda")
self.assertRegexpMatches(out, "1\s+[\d\/]+\s+with")
self.assertRegexpMatches(out, "2\s+without")
self.assertRegex(out, "1\s+[\d\/]+\s+with")
self.assertRegex(out, "2\s+without")
def test_uda_bad_date_task(self):
"""Add tasks with an invalid UDA date"""
@ -134,7 +134,7 @@ class TestUdaDefault(TestBaseUda):
self.assertIn("Created task", out)
code, out, err = self.t("uda")
self.assertRegexpMatches(out, "1\s+strong\s+one")
self.assertRegex(out, "1\s+strong\s+one")
def test_uda_default_task(self):
"""Add tasks with default UDA"""
@ -143,7 +143,7 @@ class TestUdaDefault(TestBaseUda):
self.assertIn("Created task", out)
code, out, err = self.t("uda")
self.assertRegexpMatches(out, "1\s+weak\s+two")
self.assertRegex(out, "1\s+weak\s+two")
def test_uda_without_default_task(self):
"""Add tasks without default UDA"""
@ -152,7 +152,7 @@ class TestUdaDefault(TestBaseUda):
self.assertIn("Created task", out)
code, out, err = self.t("uda")
self.assertRegexpMatches(out, "1\s+weak\s+10\s+three")
self.assertRegex(out, "1\s+weak\s+10\s+three")
class TestUdaDuration(TestBaseUda):
@ -174,7 +174,7 @@ class TestUdaDuration(TestBaseUda):
# Ensure 'extra' is stored in original form.
code, out, err = self.t("1 export")
self.assertRegexpMatches(out, '"extra":"P1D"')
self.assertRegex(out, '"extra":"P1D"')
def test_uda_bad_duration_task(self):
"""Add tasks with an invalid UDA duration"""
@ -200,8 +200,8 @@ class TestUdaNumeric(TestBaseUda):
self.assertIn("Created task", out)
code, out, err = self.t("uda")
self.assertRegexpMatches(out, "1\s+\d+\s+with")
self.assertRegexpMatches(out, "2\s+without")
self.assertRegex(out, "1\s+\d+\s+with")
self.assertRegex(out, "2\s+without")
def test_uda_bad_numeric_task(self):
"""Add tasks with an invalid UDA numeric"""
@ -225,8 +225,8 @@ class TestUdaString(TestBaseUda):
self.assertIn("Created task", out)
code, out, err = self.t("uda")
self.assertRegexpMatches(out, "1\s+one two\s+with")
self.assertRegexpMatches(out, "2\s+without")
self.assertRegex(out, "1\s+one two\s+with")
self.assertRegex(out, "2\s+without")
class TestUdaValue(TestBaseUda):
@ -245,8 +245,8 @@ class TestUdaValue(TestBaseUda):
self.assertIn("Created task", out)
code, out, err = self.t("uda")
self.assertRegexpMatches(out, "1\s+weak\s+one")
self.assertRegexpMatches(out, "2\s+strong\s+two")
self.assertRegex(out, "1\s+weak\s+one")
self.assertRegex(out, "2\s+strong\s+two")
def test_uda_invalid_value_task(self):
"""Add tasks with invalid UDA value"""
@ -259,8 +259,8 @@ class TestUdaValue(TestBaseUda):
"'toxic'", err)
code, out, err = self.t("uda")
self.assertRegexpMatches(out, "1\s+strong\s+one")
self.assertNotRegexpMatches(out, "1\s+toxic\s+two")
self.assertRegex(out, "1\s+strong\s+one")
self.assertNotRegex(out, "1\s+toxic\s+two")
class TestBug1063(TestCase):
@ -287,11 +287,11 @@ class TestBug1063(TestCase):
code, out, err = self.t("bar")
expected = re.compile("4.+3.+2.+1", re.DOTALL) # dot matches \n too
self.assertRegexpMatches(out, expected)
self.assertRegex(out, expected)
code, out, err = self.t("bar rc.report.bar.sort=foo+")
expected = re.compile("1.+2.+3.+4", re.DOTALL) # dot matches \n too
self.assertRegexpMatches(out, expected)
self.assertRegex(out, expected)
class TestBug21(TestCase):

View file

@ -56,12 +56,12 @@ class TestUDAOrphans(TestCase):
# 'info' should show orphans.
code, out, err = self.t("1 info")
self.assertRegexpMatches(out, "\[extra\s+foo\]")
self.assertRegex(out, "\[extra\s+foo\]")
# 'modify' should not change the orphan
self.t("1 modify /one/two/")
code, out, err = self.t("1 info")
self.assertRegexpMatches(out, "\[extra\s+foo\]")
self.assertRegex(out, "\[extra\s+foo\]")
# 'export' should include orphans.
code, out, err = self.t("1 export")

View file

@ -147,7 +147,7 @@ class TestBug1319(TestCase):
self.t("add four when:morning")
code, out, err = self.t("rc.verbose:nothing foo")
self.assertRegexpMatches(out, "4\s+morning\s+four\s+3\s+noon\s+three\s+2\s+evening\s+two\s+1\s+night\s+one")
self.assertRegex(out, "4\s+morning\s+four\s+3\s+noon\s+three\s+2\s+evening\s+two\s+1\s+night\s+one")
if __name__ == "__main__":

View file

@ -78,15 +78,15 @@ class TestUndoStyle(TestCase):
"""Test that 'rc.undo.style:side' generates the right output"""
self.t.config("undo.style", "side")
code, out, err = self.t("undo", input="n\n")
self.assertNotRegexpMatches(out, "-tags:\s*\n\+tags:\s+tag")
self.assertRegexpMatches(out, "tags\s+tag\s*")
self.assertNotRegex(out, "-tags:\s*\n\+tags:\s+tag")
self.assertRegex(out, "tags\s+tag\s*")
def test_undo_diff_style(self):
"""Test that 'rc.undo.style:diff' generates the right output"""
self.t.config("undo.style", "diff")
code, out, err = self.t("undo", input="n\n")
self.assertRegexpMatches(out, "-tags:\s*\n\+tags:\s+tag")
self.assertNotRegexpMatches(out, "tags\s+tag\s*")
self.assertRegex(out, "-tags:\s*\n\+tags:\s+tag")
self.assertNotRegex(out, "tags\s+tag\s*")
class TestBug634(TestCase):

View file

@ -44,19 +44,19 @@ class TestUpgrade(TestCase):
self.t("add one")
code, out, err = self.t("1 info")
self.assertRegexpMatches(out, "Status\s+Pending")
self.assertRegex(out, "Status\s+Pending")
self.t("1 modify due:tomorrow recur:weekly")
self.t("list")
code, out, err = self.t("1 info")
self.assertRegexpMatches(out, "Status\s+Recurring")
self.assertRegexpMatches(out, "Recurrence\s+weekly")
self.assertRegex(out, "Status\s+Recurring")
self.assertRegex(out, "Recurrence\s+weekly")
# Also check for the presence of a children task with pending state
code, out, err = self.t("2 info")
self.assertRegexpMatches(out, "Status\s+Pending")
self.assertRegexpMatches(out, "Recurrence\s+weekly")
self.assertRegex(out, "Status\s+Pending")
self.assertRegex(out, "Recurrence\s+weekly")
if __name__ == "__main__":

View file

@ -50,20 +50,20 @@ class TestVerbosity(TestCase):
def test_verbosity_new_id(self):
"""Verbosity new-id"""
code, out, err = self.t("rc.verbose:new-id add Sample1")
self.assertRegexpMatches(out, r"Created task \d")
self.assertRegex(out, r"Created task \d")
code, out, err = self.t("rc.verbose:nothing add Sample2")
self.assertNotRegexpMatches(out, r"Created task \d")
self.assertNotRegex(out, r"Created task \d")
def test_verbosity_new_uuid(self):
"""Verbosity new-uuid"""
code, out, err = self.t(("rc.verbose:new-uuid", "add", "Sample1"))
self.assertRegexpMatches(out, r"Created task [0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}")
self.assertRegex(out, r"Created task [0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}")
def test_verbosity_label(self):
"""Verbosity label"""
code, out, err = self.t("rc.verbose:label ls")
self.assertRegexpMatches(
self.assertRegex(
out,
"ID.+A.+D.+Project.+Tags.+R.+Wait.+S.+Due.+Until.+Description"
)
@ -73,15 +73,15 @@ class TestVerbosity(TestCase):
code, out, err = self.t("rc.verbose:affected ls")
expected = re.compile(r"^\d+ tasks?$", re.MULTILINE)
self.assertRegexpMatches(out, expected)
self.assertRegex(out, expected)
def test_verbosity_off(self):
"""Verbosity off"""
code, out, err = self.t("rc.verbose:nothing ls")
expected = re.compile(r"^\d+ tasks?$", re.MULTILINE)
self.assertNotRegexpMatches(out, expected)
self.assertNotRegexpMatches(out, "ID.+Project.+Pri.+Description")
self.assertNotRegex(out, expected)
self.assertNotRegex(out, "ID.+Project.+Pri.+Description")
def test_verbosity_special(self):
"""Verbosity special"""

View file

@ -55,7 +55,7 @@ class TestVersion(TestCase):
code, out, err = self.t("version")
expected = "Copyright \(C\) \d{4} - %d" % (datetime.now().year,)
self.assertRegexpMatches(out, expected)
self.assertRegex(out, expected)
def slurp(self, file="../CMakeLists.txt"):
number = "\.".join(["[0-9]+"] * 3)
@ -85,7 +85,7 @@ class TestVersion(TestCase):
def test_version_option(self):
"""Verify that 'task --version' returns something valid"""
code, out, err = self.t("--version")
self.assertRegexpMatches(out, r'^\d\.\d+\.\d+(\.\w+)?$')
self.assertRegex(out, r'^\d\.\d+\.\d+(\.\w+)?$')
if __name__ == "__main__":