Commit b940710d authored by Bram Schoenmakers's avatar Bram Schoenmakers

Add test for the View class.

Also, adapt run.sh such that every test is automatically run when no
specific test was given as a parameter.
parent c5cae105
import unittest
import Filter
import Sorter
from TestFacilities import load_file, todolist_to_string
import TodoFile
import TodoList
class ViewTest(unittest.TestCase):
def test_view(self):
""" Check filters and printer for views. """
todofile = TodoFile.TodoFile('data/FilterTest1.txt')
ref = load_file('data/ViewTest1-result.txt')
todolist = TodoList.TodoList(todofile.read())
sorter = Sorter.Sorter('text')
todofilter = Filter.GrepFilter('+Project')
view = todolist.view(sorter, [todofilter])
self.assertEquals(str(view), todolist_to_string(ref))
......@@ -5,9 +5,9 @@ PYTHONPATH=..
if [ -n "$1" ]; then
TESTS=$1
else
TESTS="FilterTest SorterTest TodoBaseTest TodoFileTest TodoTest TodoListTest"
TESTS="*Test.py"
fi
for TEST in $TESTS; do
python -m unittest "$TEST"
python -m unittest "${TEST%\.*}" # strip the .py extension
done
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