Unit Tests

- Commented out the bare word tests. Bare word searching is deprecated and these
  failures are the reason why. Retaining the tests for possible later rescue.
- Modified remaining tests because there is a difference in adding 'foo-' and
  searching for 'foo\\-'.
This commit is contained in:
Paul Beckingham 2014-10-11 11:29:23 -04:00
parent 630d0f209e
commit 9325098b5c

View file

@ -15,17 +15,18 @@ class Test1418(TestCase):
def setUp(self): def setUp(self):
self.t = Task() self.t = Task()
# Helper methods
def search_task_pattern(self, description): def search_task_pattern(self, description):
# TODO escape any "/" in description - check comments on bug 1418 # TODO escape any "/" in description - check comments on bug 1418
command = ("/" + description + "/",) command = ("/" + description + "/",)
code, out, err = self.t(command) code, out, err = self.t(command)
self.assertIn(description, out) self.assertIn(description, out)
def search_task_bare(self, description): # def search_task_bare(self, description):
# TODO escape any "/" in description - check comments on bug 1418 # # TODO escape any "/" in description - check comments on bug 1418
command = (description,) # command = (description,)
code, out, err = self.t(command) # code, out, err = self.t(command)
self.assertIn(description, out) # self.assertIn(description, out)
def add_search_task(self, description): def add_search_task(self, description):
command = ("add", description) command = ("add", description)
@ -35,81 +36,80 @@ class Test1418(TestCase):
command = ("add", "description:'" + description + "'") command = ("add", "description:'" + description + "'")
code, out, err = self.t(command) code, out, err = self.t(command)
def test_slash_in_description_bare_words(self): # Tests
"""Check that you can search with a slash (/) and bare words""" # def test_slash_in_description_bare_words(self):
description = "foo/" # """Check that you can search with a slash (/) and bare words"""
self.add_search_task(description) # description = "foo/"
self.search_task_bare(description) # self.add_search_task(description)
# self.search_task_bare(description)
def test_minus_in_description_bare_words(self): # def test_minus_in_description_bare_words(self):
"""Check that you can search with a minus (-) and bare words""" # """Check that you can search with a minus (-) and bare words"""
description = "foo-" # description = "foo-"
self.add_search_task(description) # self.add_search_task(description)
self.search_task_bare(description) # self.search_task_bare(description)
def test_plus_in_description_bare_words(self): # def test_plus_in_description_bare_words(self):
"""Check that you can search with a plus (+) and bare words""" # """Check that you can search with a plus (+) and bare words"""
description = "foo+" # description = "foo+"
self.add_search_task(description) # self.add_search_task(description)
self.search_task_bare(description) # self.search_task_bare(description)
def test_explicit_slash_in_description_bare_words(self): # def test_explicit_slash_in_description_bare_words(self):
"""Can add a task with trailing slash (/) using description:"" and bare # """Can add a task with trailing slash (/) using description:"" and bare
words # words
""" # """
description = "foo/" # description = "foo/"
self.add_search_task_description(description) # self.add_search_task_description(description)
self.search_task_bare(description) # self.search_task_bare(description)
def test_explicit_minus_in_description_bare_words(self): # def test_explicit_minus_in_description_bare_words(self):
"""Can add a task with trailing minus (-) using description:"" and bare # """Can add a task with trailing minus (-) using description:"" and bare
words # words
""" # """
description = "foo-" # description = "foo-"
self.add_search_task_description(description) # self.add_search_task_description(description)
self.search_task_bare(description) # self.search_task_bare(description)
def test_explicit_plus_in_description_bare_words(self): # def test_explicit_plus_in_description_bare_words(self):
"""Can add a task with trailing plus (+) using description:"" and bare # """Can add a task with trailing plus (+) using description:"" and bare
words # words
""" # """
description = "foo+" # description = "foo+"
self.add_search_task_description(description) # self.add_search_task_description(description)
self.search_task_bare(description) # self.search_task_bare(description)
def test_slash_in_description(self): def test_slash_in_description(self):
"""Check that you can search with a slash (/)""" """Check that you can search with a slash (/)"""
description = "foo/" description = "foo\\/"
self.add_search_task(description) self.add_search_task(description)
self.search_task_pattern(description) self.search_task_pattern(description)
def test_minus_in_description(self): def test_minus_in_description(self):
"""Check that you can search with a minus (-)""" """Check that you can search with a minus (-)"""
description = "foo-" self.add_search_task("foo-")
self.add_search_task(description) self.search_task_pattern("foo\\-")
self.search_task_pattern(description)
def test_plus_in_description(self): def test_plus_in_description(self):
"""Check that you can search with a plus (+)""" """Check that you can search with a plus (+)"""
description = "foo+" description = "foo\\+"
self.add_search_task(description) self.add_search_task(description)
self.search_task_pattern(description) self.search_task_pattern(description)
def test_explicit_slash_in_description(self): def test_explicit_slash_in_description(self):
"""Can add a task with trailing slash (/) using description:"" """ """Can add a task with trailing slash (/) using description:"" """
description = "foo/" description = "foo\\/"
self.add_search_task_description(description) self.add_search_task_description(description)
self.search_task_pattern(description) self.search_task_pattern(description)
def test_explicit_minus_in_description(self): def test_explicit_minus_in_description(self):
"""Can add a task with trailing minus (-) using description:"" """ """Can add a task with trailing minus (-) using description:"" """
description = "foo-" self.add_search_task_description("foo-")
self.add_search_task_description(description) self.search_task_pattern("foo\\-")
self.search_task_pattern(description)
def test_explicit_plus_in_description(self): def test_explicit_plus_in_description(self):
"""Can add a task with trailing plus (+) using description:"" """ """Can add a task with trailing plus (+) using description:"" """
description = "foo+" description = "foo\\+"
self.add_search_task_description(description) self.add_search_task_description(description)
self.search_task_pattern(description) self.search_task_pattern(description)