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
7da73100
Commit
7da73100
authored
Nov 29, 2014
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make all other tests also independent of possible user configuration.
parent
f0f319ea
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
69 additions
and
21 deletions
+69
-21
test/CommandTest.py
test/CommandTest.py
+2
-5
test/ConfigTest.py
test/ConfigTest.py
+2
-1
test/FilterTest.py
test/FilterTest.py
+5
-2
test/GraphTest.py
test/GraphTest.py
+4
-1
test/ImportanceTest.py
test/ImportanceTest.py
+2
-1
test/RecurrenceTest.py
test/RecurrenceTest.py
+3
-1
test/RelativeDateTest.py
test/RelativeDateTest.py
+3
-1
test/SorterTest.py
test/SorterTest.py
+3
-2
test/TodoBaseTest.py
test/TodoBaseTest.py
+2
-1
test/TodoFileTest.py
test/TodoFileTest.py
+2
-1
test/TodoListTest.py
test/TodoListTest.py
+10
-3
test/TodoTest.py
test/TodoTest.py
+2
-1
test/TopydoTest.py
test/TopydoTest.py
+27
-0
test/ViewTest.py
test/ViewTest.py
+2
-1
No files found.
test/CommandTest.py
View file @
7da73100
...
...
@@ -16,18 +16,15 @@
import
unittest
from
topydo.lib.Config
import
config
from
topydo.lib.Utils
import
escape_ansi
import
TopydoTest
class
CommandTest
(
unittest
.
TestCase
):
class
CommandTest
(
TopydoTest
.
TopydoTest
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
CommandTest
,
self
).
__init__
(
*
args
,
**
kwargs
)
self
.
output
=
""
self
.
errors
=
""
def
setUp
(
self
):
config
(
""
)
def
out
(
self
,
p_output
):
if
p_output
:
self
.
output
+=
escape_ansi
(
p_output
+
"
\
n
"
)
...
...
test/ConfigTest.py
View file @
7da73100
...
...
@@ -17,8 +17,9 @@
import
unittest
from
topydo.lib.Config
import
config
import
TopydoTest
class
ConfigTest
(
unittest
.
TestCase
):
class
ConfigTest
(
TopydoTest
.
TopydoTest
):
def
test_config1
(
self
):
self
.
assertEquals
(
config
(
"test/data/config1"
).
default_command
(),
'do'
)
...
...
test/FilterTest.py
View file @
7da73100
...
...
@@ -22,8 +22,9 @@ import unittest
from
topydo.lib
import
Filter
from
TestFacilities
import
load_file
,
todolist_to_string
,
load_file_to_todolist
from
topydo.lib.Todo
import
Todo
import
TopydoTest
class
FilterTest
(
unittest
.
TestCase
):
class
FilterTest
(
TopydoTest
.
TopydoTest
):
def
test_filter3
(
self
):
todo
=
Todo
(
"(C) Relevant"
)
relevance
=
Filter
.
RelevanceFilter
()
...
...
@@ -294,8 +295,10 @@ class FilterTest(unittest.TestCase):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
class
OrdinalTagFilterTest
(
unittest
.
TestCase
):
class
OrdinalTagFilterTest
(
TopydoTest
.
TopydoTest
):
def
setUp
(
self
):
super
(
OrdinalTagFilterTest
,
self
).
setUp
()
today
=
date
.
today
()
tomorrow
=
today
+
timedelta
(
1
)
...
...
test/GraphTest.py
View file @
7da73100
...
...
@@ -17,9 +17,12 @@
import
unittest
from
topydo.lib.Graph
import
DirectedGraph
import
TopydoTest
class
GraphTest
(
unittest
.
TestCase
):
class
GraphTest
(
TopydoTest
.
TopydoTest
):
def
setUp
(
self
):
super
(
GraphTest
,
self
).
setUp
()
self
.
graph
=
DirectedGraph
()
self
.
graph
.
add_edge
(
1
,
2
,
1
)
...
...
test/ImportanceTest.py
View file @
7da73100
...
...
@@ -20,8 +20,9 @@ import unittest
from
topydo.lib.Config
import
config
from
topydo.lib.Importance
import
importance
from
topydo.lib.Todo
import
Todo
import
TopydoTest
class
ImportanceTest
(
unittest
.
TestCase
):
class
ImportanceTest
(
TopydoTest
.
TopydoTest
):
def
test_importance1
(
self
):
todo
=
Todo
(
"Foo"
)
self
.
assertEqual
(
importance
(
todo
),
2
)
...
...
test/RecurrenceTest.py
View file @
7da73100
...
...
@@ -20,9 +20,11 @@ import unittest
from
topydo.lib.Config
import
config
from
topydo.lib.Recurrence
import
advance_recurring_todo
,
strict_advance_recurring_todo
,
NoRecurrenceException
from
topydo.lib.Todo
import
Todo
import
TopydoTest
class
RecurrenceTest
(
unittest
.
TestCase
):
class
RecurrenceTest
(
TopydoTest
.
TopydoTest
):
def
setUp
(
self
):
super
(
RecurrenceTest
,
self
).
setUp
()
self
.
todo
=
Todo
(
"Test rec:1w"
)
def
test_duedate1
(
self
):
...
...
test/RelativeDateTest.py
View file @
7da73100
...
...
@@ -18,9 +18,11 @@ from datetime import date, timedelta
import
unittest
from
topydo.lib.RelativeDate
import
relative_date_to_date
import
TopydoTest
class
RelativeDateTester
(
unittest
.
TestCase
):
class
RelativeDateTester
(
TopydoTest
.
TopydoTest
):
def
setUp
(
self
):
super
(
RelativeDateTester
,
self
).
setUp
()
self
.
today
=
date
.
today
()
self
.
tomorrow
=
self
.
today
+
timedelta
(
1
)
...
...
test/SorterTest.py
View file @
7da73100
...
...
@@ -20,9 +20,10 @@ from topydo.lib.Config import config
from
topydo.lib.Sorter
import
Sorter
from
TestFacilities
import
load_file
,
todolist_to_string
,
load_file_to_todolist
import
TopydoTest
class
SorterTest
(
unittest
.
TestCase
):
def
sort_file
(
self
,
p_filename
,
p_filename_ref
,
p_sorter
):
class
SorterTest
(
TopydoTest
.
TopydoTest
):
def
sort_file
(
self
,
p_filename
,
p_filename_ref
,
p_sorter
):
"""
Sorts a file and compares it with a reference result.
Also check that the sort algorithm hasn't touched the original data.
...
...
test/TodoBaseTest.py
View file @
7da73100
...
...
@@ -21,8 +21,9 @@ import re
import
unittest
from
topydo.lib.TodoBase
import
TodoBase
import
TopydoTest
class
TodoBaseTester
(
unittest
.
TestCase
):
class
TodoBaseTester
(
TopydoTest
.
TopydoTest
):
def
test_parse_tag
(
self
):
todo
=
TodoBase
(
"(C) Test foo:bar foo:baz foo_:baz_ blah:zah:haz"
)
...
...
test/TodoFileTest.py
View file @
7da73100
...
...
@@ -17,8 +17,9 @@
import
unittest
from
TestFacilities
import
load_file
import
TopydoTest
class
TodoFileTest
(
unittest
.
TestCase
):
class
TodoFileTest
(
TopydoTest
.
TopydoTest
):
def
test_empty_file
(
self
):
todofile
=
load_file
(
'test/data/TodoFileTest1.txt'
)
...
...
test/TodoListTest.py
View file @
7da73100
...
...
@@ -24,9 +24,12 @@ from topydo.lib.Todo import Todo
from
topydo.lib.TodoFile
import
TodoFile
from
topydo.lib.TodoListBase
import
InvalidTodoException
from
topydo.lib.TodoList
import
TodoList
import
TopydoTest
class
TodoListTester
(
unittest
.
TestCase
):
class
TodoListTester
(
TopydoTest
.
TopydoTest
):
def
setUp
(
self
):
super
(
TodoListTester
,
self
).
setUp
()
self
.
todofile
=
TodoFile
(
'test/data/TodoListTest.txt'
)
lines
=
[
line
for
line
in
self
.
todofile
.
read
()
\
if
re
.
search
(
r'\
S
', line)]
...
...
@@ -209,8 +212,10 @@ class TodoListTester(unittest.TestCase):
self
.
todolist
.
set_priority
(
todo
,
'B'
)
self
.
assertEquals
(
self
.
todolist
.
todo
(
'6iu'
).
source
(),
"(B) Foo @Context2 Not@Context +Project1 Not+Project"
)
class
TodoListDependencyTester
(
unittest
.
TestCase
):
class
TodoListDependencyTester
(
TopydoTest
.
TopydoTest
):
def
setUp
(
self
):
super
(
TodoListDependencyTester
,
self
).
setUp
()
self
.
todolist
=
TodoList
([])
self
.
todolist
.
add
(
"Foo id:1"
)
self
.
todolist
.
add
(
"Bar p:1"
)
...
...
@@ -306,8 +311,10 @@ class TodoListDependencyTester(unittest.TestCase):
self
.
assertEqual
(
todo1
.
source
(),
'Foo id:1'
)
self
.
assertEqual
(
todo2
.
source
(),
'Bar p:1'
)
class
TodoListCleanDependencyTester
(
unittest
.
TestCase
):
class
TodoListCleanDependencyTester
(
TopydoTest
.
TopydoTest
):
def
setUp
(
self
):
super
(
TodoListCleanDependencyTester
,
self
).
setUp
()
self
.
todolist
=
TodoList
([])
self
.
todolist
.
add
(
"Bar p:1"
)
self
.
todolist
.
add
(
"Baz p:1 id:2"
)
...
...
test/TodoTest.py
View file @
7da73100
...
...
@@ -18,6 +18,7 @@ from datetime import date, timedelta
import
unittest
from
topydo.lib.Todo
import
Todo
import
TopydoTest
def
today_date
():
today
=
date
.
today
()
...
...
@@ -27,7 +28,7 @@ def tomorrow_date():
tomorrow
=
date
.
today
()
+
timedelta
(
days
=
1
)
return
tomorrow
.
isoformat
()
class
TodoTest
(
unittest
.
TestCase
):
class
TodoTest
(
TopydoTest
.
TopydoTest
):
def
test_due_date1
(
self
):
todo
=
Todo
(
"(C) Foo due:2014-06-09"
)
due
=
date
(
2014
,
6
,
9
)
...
...
test/TopydoTest.py
0 → 100644
View file @
7da73100
# Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 Bram Schoenmakers <me@bramschoenmakers.nl>
#
# 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
unittest
from
topydo.lib.Config
import
config
class
TopydoTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
"""
Make sure that every test case starts with a clean configuration.
"""
config
(
""
)
test/ViewTest.py
View file @
7da73100
...
...
@@ -21,8 +21,9 @@ from topydo.lib.Sorter import Sorter
from
TestFacilities
import
load_file
,
todolist_to_string
from
topydo.lib.TodoFile
import
TodoFile
from
topydo.lib.TodoList
import
TodoList
import
TopydoTest
class
ViewTest
(
unittest
.
TestCase
):
class
ViewTest
(
TopydoTest
.
TopydoTest
):
def
test_view
(
self
):
""" Check filters and printer for views. """
todofile
=
TodoFile
(
'test/data/FilterTest1.txt'
)
...
...
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