Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
f0f319ea
Commit
f0f319ea
authored
Nov 29, 2014
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make testcases runnable from unittest discover.
parent
6e02b2fd
Changes
28
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
160 additions
and
95 deletions
+160
-95
test/AddCommandTest.py
test/AddCommandTest.py
+3
-0
test/AppendCommandTest.py
test/AppendCommandTest.py
+3
-0
test/ArchiveCommandTest.py
test/ArchiveCommandTest.py
+4
-1
test/CommandTest.py
test/CommandTest.py
+3
-0
test/ConfigTest.py
test/ConfigTest.py
+5
-2
test/DeleteCommandTest.py
test/DeleteCommandTest.py
+3
-0
test/DepCommandTest.py
test/DepCommandTest.py
+3
-0
test/DepriCommandTest.py
test/DepriCommandTest.py
+3
-0
test/DoCommandTest.py
test/DoCommandTest.py
+3
-0
test/FilterTest.py
test/FilterTest.py
+45
-42
test/GraphTest.py
test/GraphTest.py
+3
-0
test/ImportanceTest.py
test/ImportanceTest.py
+3
-0
test/ListCommandTest.py
test/ListCommandTest.py
+8
-5
test/ListContextCommandTest.py
test/ListContextCommandTest.py
+5
-2
test/ListProjectCommandTest.py
test/ListProjectCommandTest.py
+5
-2
test/PostponeCommandTest.py
test/PostponeCommandTest.py
+3
-0
test/PriorityCommandTest.py
test/PriorityCommandTest.py
+3
-0
test/RecurrenceTest.py
test/RecurrenceTest.py
+3
-0
test/RelativeDateTest.py
test/RelativeDateTest.py
+3
-0
test/SortCommandTest.py
test/SortCommandTest.py
+5
-2
test/SorterTest.py
test/SorterTest.py
+23
-20
test/TagCommandTest.py
test/TagCommandTest.py
+3
-0
test/TodoFileTest.py
test/TodoFileTest.py
+4
-1
test/TodoListTest.py
test/TodoListTest.py
+6
-3
test/TodoTest.py
test/TodoTest.py
+3
-0
test/ViewTest.py
test/ViewTest.py
+5
-2
test/__init__.py
test/__init__.py
+0
-0
test/run.sh
test/run.sh
+0
-13
No files found.
test/AddCommandTest.py
View file @
f0f319ea
...
...
@@ -185,3 +185,6 @@ class AddCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
output
,
""
)
self
.
assertEquals
(
self
.
errors
,
command
.
usage
()
+
"
\
n
\
n
"
+
command
.
help
()
+
"
\
n
"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/AppendCommandTest.py
View file @
f0f319ea
...
...
@@ -79,3 +79,6 @@ class AppendCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
output
,
""
)
self
.
assertEquals
(
self
.
errors
,
command
.
usage
()
+
"
\
n
\
n
"
+
command
.
help
()
+
"
\
n
"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/ArchiveCommandTest.py
View file @
f0f319ea
...
...
@@ -21,7 +21,7 @@ from topydo.lib.TodoList import TodoList
class
ArchiveCommandTest
(
CommandTest
.
CommandTest
):
def
test_archive
(
self
):
todolist
=
TestFacilities
.
load_file_to_todolist
(
"data/ArchiveCommandTest.txt"
)
todolist
=
TestFacilities
.
load_file_to_todolist
(
"
test/
data/ArchiveCommandTest.txt"
)
archive
=
TodoList
([])
command
=
ArchiveCommand
(
todolist
,
archive
)
...
...
@@ -32,3 +32,6 @@ class ArchiveCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
str
(
todolist
),
"x Not complete
\
n
(C) Active"
)
self
.
assertEquals
(
str
(
archive
),
"x 2014-10-19 Complete
\
n
x 2014-10-20 Another one complete"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/CommandTest.py
View file @
f0f319ea
...
...
@@ -35,3 +35,6 @@ class CommandTest(unittest.TestCase):
def
error
(
self
,
p_error
):
if
p_error
:
self
.
errors
+=
escape_ansi
(
p_error
+
"
\
n
"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/ConfigTest.py
View file @
f0f319ea
...
...
@@ -20,10 +20,13 @@ from topydo.lib.Config import config
class
ConfigTest
(
unittest
.
TestCase
):
def
test_config1
(
self
):
self
.
assertEquals
(
config
(
"data/config1"
).
default_command
(),
'do'
)
self
.
assertEquals
(
config
(
"
test/
data/config1"
).
default_command
(),
'do'
)
def
test_config2
(
self
):
self
.
assertNotEquals
(
config
(
""
).
default_command
(),
'do'
)
def
test_config3
(
self
):
self
.
assertTrue
(
config
(
"data/config2"
).
ignore_weekends
())
self
.
assertTrue
(
config
(
"test/data/config2"
).
ignore_weekends
())
if
__name__
==
'__main__'
:
unittest
.
main
()
test/DeleteCommandTest.py
View file @
f0f319ea
...
...
@@ -112,3 +112,6 @@ class DeleteCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
output
,
""
)
self
.
assertEquals
(
self
.
errors
,
command
.
usage
()
+
"
\
n
\
n
"
+
command
.
help
()
+
"
\
n
"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/DepCommandTest.py
View file @
f0f319ea
...
...
@@ -246,3 +246,6 @@ class DepCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
output
,
""
)
self
.
assertEquals
(
self
.
errors
,
command
.
usage
()
+
"
\
n
\
n
"
+
command
.
help
()
+
"
\
n
"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/DepriCommandTest.py
View file @
f0f319ea
...
...
@@ -77,3 +77,6 @@ class DepriCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
output
,
""
)
self
.
assertEquals
(
self
.
errors
,
command
.
usage
()
+
"
\
n
\
n
"
+
command
.
help
()
+
"
\
n
"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/DoCommandTest.py
View file @
f0f319ea
...
...
@@ -252,3 +252,6 @@ class DoCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
output
,
""
)
self
.
assertEquals
(
self
.
errors
,
command
.
usage
()
+
"
\
n
\
n
"
+
command
.
help
()
+
"
\
n
"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/FilterTest.py
View file @
f0f319ea
This diff is collapsed.
Click to expand it.
test/GraphTest.py
View file @
f0f319ea
...
...
@@ -167,3 +167,6 @@ class GraphTest(unittest.TestCase):
def
test_dot_output_without_labels
(
self
):
out
=
'digraph g {
\
n
1
\
n
1 -> 2
\
n
1 -> 3
\
n
2
\
n
2 -> 4
\
n
3
\
n
3 -> 5
\
n
4
\
n
4 -> 3
\
n
4 -> 6
\
n
5
\
n
6
\
n
6 -> 2
\
n
}
\
n
'
self
.
assertEquals
(
self
.
graph
.
dot
(
False
),
out
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/ImportanceTest.py
View file @
f0f319ea
...
...
@@ -38,3 +38,6 @@ class ImportanceTest(unittest.TestCase):
today_str
=
date
.
today
().
isoformat
()
todo
=
Todo
(
"(C) Foo "
+
config
().
tag_due
()
+
":"
+
today_str
)
self
.
assertEqual
(
importance
(
todo
),
8
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/ListCommandTest.py
View file @
f0f319ea
...
...
@@ -22,7 +22,7 @@ import TestFacilities
class
ListCommandTest
(
CommandTest
.
CommandTest
):
def
setUp
(
self
):
super
(
ListCommandTest
,
self
).
setUp
()
self
.
todolist
=
TestFacilities
.
load_file_to_todolist
(
"data/ListCommandTest.txt"
)
self
.
todolist
=
TestFacilities
.
load_file_to_todolist
(
"
test/
data/ListCommandTest.txt"
)
def
tearDown
(
self
):
# restore to the default configuration in case a custom one was set
...
...
@@ -101,7 +101,7 @@ class ListCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
errors
,
""
)
def
test_list11
(
self
):
config
(
"data/listcommand.conf"
)
config
(
"
test/
data/listcommand.conf"
)
command
=
ListCommand
([
"project"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
@@ -111,7 +111,7 @@ class ListCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
errors
,
""
)
def
test_list12
(
self
):
config
(
"data/listcommand.conf"
)
config
(
"
test/
data/listcommand.conf"
)
command
=
ListCommand
([
"-x"
,
"project"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
@@ -129,7 +129,7 @@ class ListCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
errors
,
""
)
def
test_list14
(
self
):
config
(
"data/listcommand2.conf"
)
config
(
"
test/
data/listcommand2.conf"
)
command
=
ListCommand
([],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
@@ -147,7 +147,7 @@ class ListCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
errors
,
""
)
def
test_list16
(
self
):
config
(
"data/todolist-uid.conf"
)
config
(
"
test/
data/todolist-uid.conf"
)
command
=
ListCommand
([],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
@@ -170,3 +170,6 @@ class ListCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
output
,
""
)
self
.
assertEquals
(
self
.
errors
,
command
.
usage
()
+
"
\
n
\
n
"
+
command
.
help
()
+
"
\
n
"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/ListContextCommandTest.py
View file @
f0f319ea
...
...
@@ -20,7 +20,7 @@ from topydo.lib.ListContextCommand import ListContextCommand
class
ListContextCommandTest
(
CommandTest
.
CommandTest
):
def
test_contexts1
(
self
):
todolist
=
TestFacilities
.
load_file_to_todolist
(
"data/TodoListTest.txt"
)
todolist
=
TestFacilities
.
load_file_to_todolist
(
"
test/
data/TodoListTest.txt"
)
command
=
ListContextCommand
([
""
],
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
@@ -28,7 +28,7 @@ class ListContextCommandTest(CommandTest.CommandTest):
self
.
assertFalse
(
self
.
errors
)
def
test_contexts2
(
self
):
todolist
=
TestFacilities
.
load_file_to_todolist
(
"data/TodoListTest.txt"
)
todolist
=
TestFacilities
.
load_file_to_todolist
(
"
test/
data/TodoListTest.txt"
)
command
=
ListContextCommand
([
"aaa"
],
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
@@ -41,3 +41,6 @@ class ListContextCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
output
,
""
)
self
.
assertEquals
(
self
.
errors
,
command
.
usage
()
+
"
\
n
\
n
"
+
command
.
help
()
+
"
\
n
"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/ListProjectCommandTest.py
View file @
f0f319ea
...
...
@@ -20,7 +20,7 @@ from topydo.lib.ListProjectCommand import ListProjectCommand
class
ListProjectCommandTest
(
CommandTest
.
CommandTest
):
def
test_projects1
(
self
):
todolist
=
TestFacilities
.
load_file_to_todolist
(
"data/TodoListTest.txt"
)
todolist
=
TestFacilities
.
load_file_to_todolist
(
"
test/
data/TodoListTest.txt"
)
command
=
ListProjectCommand
([
""
],
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
@@ -28,7 +28,7 @@ class ListProjectCommandTest(CommandTest.CommandTest):
self
.
assertFalse
(
self
.
errors
)
def
test_projects2
(
self
):
todolist
=
TestFacilities
.
load_file_to_todolist
(
"data/TodoListTest.txt"
)
todolist
=
TestFacilities
.
load_file_to_todolist
(
"
test/
data/TodoListTest.txt"
)
command
=
ListProjectCommand
([
"aaa"
],
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
@@ -41,3 +41,6 @@ class ListProjectCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
output
,
""
)
self
.
assertEquals
(
self
.
errors
,
command
.
usage
()
+
"
\
n
\
n
"
+
command
.
help
()
+
"
\
n
"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/PostponeCommandTest.py
View file @
f0f319ea
...
...
@@ -170,3 +170,6 @@ class PostponeCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
output
,
""
)
self
.
assertEquals
(
self
.
errors
,
command
.
usage
()
+
"
\
n
\
n
"
+
command
.
help
()
+
"
\
n
"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/PriorityCommandTest.py
View file @
f0f319ea
...
...
@@ -106,3 +106,6 @@ class PriorityCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
output
,
""
)
self
.
assertEquals
(
self
.
errors
,
command
.
usage
()
+
"
\
n
\
n
"
+
command
.
help
()
+
"
\
n
"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/RecurrenceTest.py
View file @
f0f319ea
...
...
@@ -135,3 +135,6 @@ class RecurrenceTest(unittest.TestCase):
def
test_no_recurrence
(
self
):
self
.
todo
.
remove_tag
(
'rec'
)
self
.
assertRaises
(
NoRecurrenceException
,
advance_recurring_todo
,
self
.
todo
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/RelativeDateTest.py
View file @
f0f319ea
...
...
@@ -108,3 +108,6 @@ class RelativeDateTester(unittest.TestCase):
def
test_offset1
(
self
):
result
=
relative_date_to_date
(
'1d'
,
self
.
tomorrow
)
self
.
assertEquals
(
result
,
date
.
today
()
+
timedelta
(
2
))
if
__name__
==
'__main__'
:
unittest
.
main
()
test/SortCommandTest.py
View file @
f0f319ea
...
...
@@ -22,7 +22,7 @@ import TestFacilities
class
SortCommandTest
(
CommandTest
.
CommandTest
):
def
setUp
(
self
):
super
(
SortCommandTest
,
self
).
setUp
()
self
.
todolist
=
TestFacilities
.
load_file_to_todolist
(
"data/SorterTest1.txt"
)
self
.
todolist
=
TestFacilities
.
load_file_to_todolist
(
"
test/
data/SorterTest1.txt"
)
def
tearDown
(
self
):
# restore to the default configuration in case a custom one was set
...
...
@@ -43,7 +43,7 @@ class SortCommandTest(CommandTest.CommandTest):
def
test_sort3
(
self
):
""" Check that order does not influence the UID of a todo. """
config
(
"data/todolist-uid.conf"
)
config
(
"
test/
data/todolist-uid.conf"
)
todo1
=
self
.
todolist
.
todo
(
'tpi'
)
command
=
SortCommand
([
"text"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
...
...
@@ -58,3 +58,6 @@ class SortCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
output
,
""
)
self
.
assertEquals
(
self
.
errors
,
command
.
usage
()
+
"
\
n
\
n
"
+
command
.
help
()
+
"
\
n
"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/SorterTest.py
View file @
f0f319ea
...
...
@@ -38,21 +38,21 @@ class SorterTest(unittest.TestCase):
def
test_sort1
(
self
):
""" Alphabetically sorted """
sorter
=
Sorter
(
'text'
)
self
.
sort_file
(
'
data/SorterTest1.txt'
,
'
data/SorterTest1-result.txt'
,
sorter
)
self
.
sort_file
(
'
test/data/SorterTest1.txt'
,
'test/
data/SorterTest1-result.txt'
,
sorter
)
def
test_sort2a
(
self
):
"""
Ascendingly sorted by priority. Also checks stableness of the sort.
"""
sorter
=
Sorter
(
'prio'
)
self
.
sort_file
(
'
data/SorterTest2.txt'
,
'
data/SorterTest2-result.txt'
,
sorter
)
self
.
sort_file
(
'
test/data/SorterTest2.txt'
,
'test/
data/SorterTest2-result.txt'
,
sorter
)
def
test_sort2b
(
self
):
"""
Ascendingly sorted by priority. Also checks stableness of the sort.
"""
sorter
=
Sorter
(
'asc:prio'
)
self
.
sort_file
(
'
data/SorterTest2.txt'
,
'
data/SorterTest2-result.txt'
,
sorter
)
self
.
sort_file
(
'
test/data/SorterTest2.txt'
,
'test/
data/SorterTest2-result.txt'
,
sorter
)
def
test_sort3
(
self
):
"""
...
...
@@ -60,32 +60,32 @@ class SorterTest(unittest.TestCase):
sort.
"""
sorter
=
Sorter
(
'desc:prio'
)
self
.
sort_file
(
'
data/SorterTest3.txt'
,
'
data/SorterTest3-result.txt'
,
sorter
)
self
.
sort_file
(
'
test/data/SorterTest3.txt'
,
'test/
data/SorterTest3-result.txt'
,
sorter
)
def
test_sort4
(
self
):
""" Ascendingly sorted by due date """
sorter
=
Sorter
(
config
().
tag_due
())
self
.
sort_file
(
'
data/SorterTest4.txt'
,
'
data/SorterTest4-result.txt'
,
sorter
)
self
.
sort_file
(
'
test/data/SorterTest4.txt'
,
'test/
data/SorterTest4-result.txt'
,
sorter
)
def
test_sort5
(
self
):
""" Descendingly sorted by due date """
sorter
=
Sorter
(
'desc:due'
)
self
.
sort_file
(
'
data/SorterTest5.txt'
,
'
data/SorterTest5-result.txt'
,
sorter
)
self
.
sort_file
(
'
test/data/SorterTest5.txt'
,
'test/
data/SorterTest5-result.txt'
,
sorter
)
def
test_sort6
(
self
):
""" Ascendingly sorted by creation date """
sorter
=
Sorter
(
'creation'
)
self
.
sort_file
(
'
data/SorterTest6.txt'
,
'
data/SorterTest6-result.txt'
,
sorter
)
self
.
sort_file
(
'
test/data/SorterTest6.txt'
,
'test/
data/SorterTest6-result.txt'
,
sorter
)
def
test_sort7
(
self
):
""" Ascendingly sorted by completion date. """
sorter
=
Sorter
(
'completion'
)
self
.
sort_file
(
'
data/SorterTest7.txt'
,
'
data/SorterTest7-result.txt'
,
sorter
)
self
.
sort_file
(
'
test/data/SorterTest7.txt'
,
'test/
data/SorterTest7-result.txt'
,
sorter
)
def
test_sort8
(
self
):
""" Descendingly sorted by importance """
sorter
=
Sorter
(
'desc:importance'
)
self
.
sort_file
(
'
data/SorterTest8.txt'
,
'
data/SorterTest8-result.txt'
,
sorter
)
self
.
sort_file
(
'
test/data/SorterTest8.txt'
,
'test/
data/SorterTest8-result.txt'
,
sorter
)
def
test_sort9
(
self
):
"""
...
...
@@ -93,22 +93,22 @@ class SorterTest(unittest.TestCase):
ascending priority.
"""
sorter
=
Sorter
(
'desc:importance,priority'
)
self
.
sort_file
(
'
data/SorterTest9.txt'
,
'
data/SorterTest9-result.txt'
,
sorter
)
self
.
sort_file
(
'
test/data/SorterTest9.txt'
,
'test/
data/SorterTest9-result.txt'
,
sorter
)
def
test_sort10
(
self
):
""" Deal with garbage input. """
sorter
=
Sorter
(
''
)
self
.
sort_file
(
'
data/SorterTest9.txt'
,
'
data/SorterTest9.txt'
,
sorter
)
self
.
sort_file
(
'
test/data/SorterTest9.txt'
,
'test/
data/SorterTest9.txt'
,
sorter
)
def
test_sort11
(
self
):
""" Deal with garbage input. """
sorter
=
Sorter
(
'fnord'
)
self
.
sort_file
(
'
data/SorterTest9.txt'
,
'
data/SorterTest9.txt'
,
sorter
)
self
.
sort_file
(
'
test/data/SorterTest9.txt'
,
'test/
data/SorterTest9.txt'
,
sorter
)
def
test_sort12
(
self
):
""" Deal with garbage input. """
sorter
=
Sorter
(
'desc:importance,,priority'
)
self
.
sort_file
(
'
data/SorterTest9.txt'
,
'
data/SorterTest9-result.txt'
,
sorter
)
self
.
sort_file
(
'
test/data/SorterTest9.txt'
,
'test/
data/SorterTest9-result.txt'
,
sorter
)
def
test_sort13
(
self
):
"""
...
...
@@ -118,14 +118,14 @@ class SorterTest(unittest.TestCase):
dependencies the average importance should be equal.
"""
sorter
=
Sorter
(
'desc:importance-avg'
)
self
.
sort_file
(
'
data/SorterTest9.txt'
,
'
data/SorterTest9-result.txt'
,
sorter
)
self
.
sort_file
(
'
test/data/SorterTest9.txt'
,
'test/
data/SorterTest9-result.txt'
,
sorter
)
def
test_sort14
(
self
):
sorter
=
Sorter
(
'desc:importance-average'
)
todolist
=
load_file_to_todolist
(
'data/SorterTest10.txt'
)
todolist
=
load_file_to_todolist
(
'
test/
data/SorterTest10.txt'
)
view
=
todolist
.
view
(
sorter
,
[])
result
=
load_file
(
'data/SorterTest10-result.txt'
)
result
=
load_file
(
'
test/
data/SorterTest10-result.txt'
)
self
.
assertEquals
(
str
(
view
),
todolist_to_string
(
result
))
...
...
@@ -136,9 +136,9 @@ class SorterTest(unittest.TestCase):
"""
sorter
=
Sorter
(
'desc:importance-average'
)
todolist
=
load_file_to_todolist
(
'data/SorterTest11.txt'
)
todolist
=
load_file_to_todolist
(
'
test/
data/SorterTest11.txt'
)
view
=
todolist
.
view
(
sorter
,
[])
result
=
load_file
(
'data/SorterTest11-result.txt'
)
result
=
load_file
(
'
test/
data/SorterTest11-result.txt'
)
self
.
assertEquals
(
str
(
view
),
todolist_to_string
(
result
))
...
...
@@ -148,8 +148,11 @@ class SorterTest(unittest.TestCase):
"""
sorter
=
Sorter
(
'desc:importance,desc:prio'
)
todolist
=
load_file_to_todolist
(
'data/SorterTest12.txt'
)
todolist
=
load_file_to_todolist
(
'
test/
data/SorterTest12.txt'
)
view
=
todolist
.
view
(
sorter
,
[])
result
=
load_file
(
'data/SorterTest12-result.txt'
)
result
=
load_file
(
'
test/
data/SorterTest12-result.txt'
)
self
.
assertEquals
(
str
(
view
),
todolist_to_string
(
result
))
if
__name__
==
'__main__'
:
unittest
.
main
()
test/TagCommandTest.py
View file @
f0f319ea
...
...
@@ -199,3 +199,6 @@ class TagCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
output
,
""
)
self
.
assertEquals
(
self
.
errors
,
command
.
usage
()
+
"
\
n
\
n
"
+
command
.
help
()
+
"
\
n
"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/TodoFileTest.py
View file @
f0f319ea
...
...
@@ -20,6 +20,9 @@ from TestFacilities import load_file
class
TodoFileTest
(
unittest
.
TestCase
):
def
test_empty_file
(
self
):
todofile
=
load_file
(
'data/TodoFileTest1.txt'
)
todofile
=
load_file
(
'
test/
data/TodoFileTest1.txt'
)
self
.
assertEquals
(
len
(
todofile
),
0
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/TodoListTest.py
View file @
f0f319ea
...
...
@@ -27,7 +27,7 @@ from topydo.lib.TodoList import TodoList
class
TodoListTester
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
todofile
=
TodoFile
(
'data/TodoListTest.txt'
)
self
.
todofile
=
TodoFile
(
'
test/
data/TodoListTest.txt'
)
lines
=
[
line
for
line
in
self
.
todofile
.
read
()
\
if
re
.
search
(
r'\
S
', line)]
self.text = ''.join(lines)
...
...
@@ -197,13 +197,13 @@ class TodoListTester(unittest.TestCase):
self
.
assertEquals
(
todo
.
source
(),
"(D) Bar @Context1 +Project2"
)
def
test_uid1
(
self
):
config
(
"data/todolist-uid.conf"
)
config
(
"
test/
data/todolist-uid.conf"
)
self
.
assertEquals
(
self
.
todolist
.
todo
(
'6iu'
).
source
(),
"(C) Foo @Context2 Not@Context +Project1 Not+Project"
)
def
test_uid2
(
self
):
""" Changing the priority should not change the identifier. """
config
(
"data/todolist-uid.conf"
)
config
(
"
test/
data/todolist-uid.conf"
)
todo
=
self
.
todolist
.
todo
(
'6iu'
)
self
.
todolist
.
set_priority
(
todo
,
'B'
)
...
...
@@ -320,3 +320,6 @@ class TodoListCleanDependencyTester(unittest.TestCase):
self
.
assertFalse
(
self
.
todolist
.
todo
(
2
).
has_tag
(
'p'
))
self
.
assertTrue
(
self
.
todolist
.
todo
(
2
).
has_tag
(
'id'
,
'2'
))
self
.
assertTrue
(
self
.
todolist
.
todo
(
3
).
has_tag
(
'p'
,
'2'
))
if
__name__
==
'__main__'
:
unittest
.
main
()
test/TodoTest.py
View file @
f0f319ea
...
...
@@ -85,3 +85,6 @@ class TodoTest(unittest.TestCase):
def
test_length3
(
self
):
todo
=
Todo
(
"(C) Foo t:2014-01-01 due:2014-01-02"
)
self
.
assertEqual
(
todo
.
length
(),
1
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/ViewTest.py
View file @
f0f319ea
...
...
@@ -25,8 +25,8 @@ from topydo.lib.TodoList import TodoList
class
ViewTest
(
unittest
.
TestCase
):
def
test_view
(
self
):
""" Check filters and printer for views. """
todofile
=
TodoFile
(
'data/FilterTest1.txt'
)
ref
=
load_file
(
'data/ViewTest1-result.txt'
)
todofile
=
TodoFile
(
'
test/
data/FilterTest1.txt'
)
ref
=
load_file
(
'
test/
data/ViewTest1-result.txt'
)
todolist
=
TodoList
(
todofile
.
read
())
sorter
=
Sorter
(
'text'
)
...
...
@@ -35,3 +35,6 @@ class ViewTest(unittest.TestCase):
self
.
assertEquals
(
str
(
view
),
todolist_to_string
(
ref
))
if
__name__
==
'__main__'
:
unittest
.
main
()
test/__init__.py
0 → 100644
View file @
f0f319ea
test/run.sh
deleted
100755 → 0
View file @
6e02b2fd
#!/bin/bash
export
PYTHONPATH
=
..
if
[
-n
"
$1
"
]
;
then
TESTS
=
$1
else
TESTS
=
"*Test.py"
fi
for
TEST
in
$TESTS
;
do
python
-m
unittest
"
${
TEST
%\.*
}
"
# strip the .py extension
done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment