Commit c146d574 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Various fixes based on pyflakes.

parent a37294da
# Topydo - A todo.txt client written in Python. # Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 Bram Schoenmakers <me@bramschoenmakers.nl> # Copyright (C) 2014 Bram Schoenmakers <me@bramschoenmakers.nl>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
...@@ -20,9 +20,8 @@ from datetime import date, timedelta ...@@ -20,9 +20,8 @@ from datetime import date, timedelta
import unittest import unittest
import Filter import Filter
from TestFacilities import * from TestFacilities import load_file, todolist_to_string, load_file_to_todolist
import Todo import Todo
import TodoList
class FilterTest(unittest.TestCase): class FilterTest(unittest.TestCase):
def test_filter3(self): def test_filter3(self):
...@@ -194,16 +193,15 @@ class FilterTest(unittest.TestCase): ...@@ -194,16 +193,15 @@ class FilterTest(unittest.TestCase):
self.assertEquals(todolist_to_string(filtered_todos), \ self.assertEquals(todolist_to_string(filtered_todos), \
todolist_to_string(reference)) todolist_to_string(reference))
def test_filter20(self): def test_filter20(self):
todos = load_file('data/FilterTest3.txt') todos = load_file('data/FilterTest3.txt')
otf = Filter.OrdinalTagFilter('due:=2014-11-10') otf = Filter.OrdinalTagFilter('due:=2014-11-10')
filtered_todos = otf.filter(todos) filtered_todos = otf.filter(todos)
reference = load_file('data/FilterTest6-result.txt')
self.assertEquals(todolist_to_string(filtered_todos), "") self.assertEquals(todolist_to_string(filtered_todos), "")
def test_filter21(self): def test_filter21(self):
todos = load_file('data/FilterTest3.txt') todos = load_file('data/FilterTest3.txt')
otf = Filter.OrdinalTagFilter('due:=2014-11-10') otf = Filter.OrdinalTagFilter('due:=2014-11-10')
...@@ -211,7 +209,7 @@ class FilterTest(unittest.TestCase): ...@@ -211,7 +209,7 @@ class FilterTest(unittest.TestCase):
filtered_todos = otf.filter(todos) filtered_todos = otf.filter(todos)
self.assertEquals(todolist_to_string(filtered_todos), "") self.assertEquals(todolist_to_string(filtered_todos), "")
def test_filter22(self): def test_filter22(self):
todos = load_file('data/FilterTest3.txt') todos = load_file('data/FilterTest3.txt')
otf = Filter.OrdinalTagFilter('due:=2014-11-99') otf = Filter.OrdinalTagFilter('due:=2014-11-99')
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from Config import config, _Config from Config import config
import CommandTest import CommandTest
import ListCommand import ListCommand
import TestFacilities import TestFacilities
......
# Topydo - A todo.txt client written in Python. # Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 Bram Schoenmakers <me@bramschoenmakers.nl> # Copyright (C) 2014 Bram Schoenmakers <me@bramschoenmakers.nl>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
...@@ -99,7 +99,7 @@ class RecurrenceTest(unittest.TestCase): ...@@ -99,7 +99,7 @@ class RecurrenceTest(unittest.TestCase):
self.assertTrue(new_todo.has_tag(config().tag_due())) self.assertTrue(new_todo.has_tag(config().tag_due()))
self.assertEquals(new_todo.due_date(), new_due) self.assertEquals(new_todo.due_date(), new_due)
def test_startdate(self): def test_startdate1(self):
""" Start date is before due date. """ """ Start date is before due date. """
self.todo.set_tag(config().tag_due(), date.today().isoformat()) self.todo.set_tag(config().tag_due(), date.today().isoformat())
yesterday = date.today() - timedelta(1) yesterday = date.today() - timedelta(1)
...@@ -110,7 +110,7 @@ class RecurrenceTest(unittest.TestCase): ...@@ -110,7 +110,7 @@ class RecurrenceTest(unittest.TestCase):
self.assertEquals(new_todo.start_date(), new_start) self.assertEquals(new_todo.start_date(), new_start)
def test_startdate(self): def test_startdate2(self):
""" Strict recurrence. Start date is before due date. """ """ Strict recurrence. Start date is before due date. """
due = date.today() - timedelta(1) due = date.today() - timedelta(1)
self.todo.set_tag(config().tag_due(), date.today().isoformat()) self.todo.set_tag(config().tag_due(), date.today().isoformat())
...@@ -122,7 +122,7 @@ class RecurrenceTest(unittest.TestCase): ...@@ -122,7 +122,7 @@ class RecurrenceTest(unittest.TestCase):
self.assertEquals(new_todo.start_date(), new_start) self.assertEquals(new_todo.start_date(), new_start)
def test_startdate2(self): def test_startdate3(self):
""" Start date equals due date. """ """ Start date equals due date. """
self.todo.set_tag(config().tag_due(), date.today().isoformat()) self.todo.set_tag(config().tag_due(), date.today().isoformat())
self.todo.set_tag(config().tag_start(), date.today().isoformat()) self.todo.set_tag(config().tag_start(), date.today().isoformat())
......
...@@ -18,8 +18,6 @@ import unittest ...@@ -18,8 +18,6 @@ import unittest
from Config import config from Config import config
import Sorter import Sorter
import TodoList
import View
from TestFacilities import load_file, todolist_to_string, load_file_to_todolist from TestFacilities import load_file, todolist_to_string, load_file_to_todolist
......
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