Commit f1d2414d authored by Bram Schoenmakers's avatar Bram Schoenmakers

Fix bug when case sensitivity is explicitly turned off.

When passing False for case sensitivity, it would fall into the logic
to automatically determine whether case sensitivity is desired
based on the appearance of capitals.
parent 740fb463
......@@ -18,7 +18,7 @@ class GrepFilter(Filter):
def __init__(self, p_expression, p_case_sensitive=None):
self.expression = p_expression
if p_case_sensitive:
if p_case_sensitive != None:
self.case_sensitive = p_case_sensitive
else:
# only be case sensitive when the expression contains at least one
......
......@@ -73,3 +73,14 @@ class FilterTest(unittest.TestCase):
self.assertEquals(todolist_to_string(filtered_todos), \
todolist_to_string(reference))
def test_filter8(self):
""" Test case sensitive match (forced, with lowercase). """
todos = load_file('data/FilterTest1.txt')
grep = Filter.GrepFilter('+Project', False)
filtered_todos = grep.filter(todos)
reference = load_file('data/FilterTest1a-result.txt')
self.assertEquals(todolist_to_string(filtered_todos), \
todolist_to_string(reference))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment