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
94c2d5cb
Commit
94c2d5cb
authored
Jun 13, 2014
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for printing the todos.
Make sure the content is preserved byte by byte.
parent
b53b24af
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
+12
-7
TodoBase.py
TodoBase.py
+1
-1
TodoList.py
TodoList.py
+2
-5
test/TodoListTest.py
test/TodoListTest.py
+9
-1
No files found.
TodoBase.py
View file @
94c2d5cb
...
...
@@ -161,4 +161,4 @@ class TodoBase(object):
def __str__(self):
""" A printer for the todo item. """
print self.source() + "
\
n
"
return self.source()
TodoList.py
View file @
94c2d5cb
...
...
@@ -99,12 +99,9 @@ class TodoList(object):
defined by the end user. Todos is this list should not be modified,
modifications should occur through this class.
"""
# TODO: perhaps change list such that values are immutable?
return
p_filter
.
filter
(
p_sorter
.
sort
(
self
.
_todos
))
def
__str__
(
self
):
result
=
""
for
todo
in
self
.
_todos
:
result
=
"%s"
%
todo
return
result
return
'
\
n
'
.
join
([
str
(
x
)
for
x
in
self
.
_todos
])
test/TodoListTest.py
View file @
94c2d5cb
...
...
@@ -9,7 +9,9 @@ import TodoList
class
TodoListTester
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
todofile
=
TodoFile
.
TodoFile
(
'TodoListTest.txt'
)
self
.
todolist
=
TodoList
.
TodoList
(
self
.
todofile
.
read
())
lines
=
self
.
todofile
.
read
()
self
.
text
=
''
.
join
(
lines
)
self
.
todolist
=
TodoList
.
TodoList
(
lines
)
def
test_contexts
(
self
):
self
.
assertEquals
(
set
([
'Context1'
,
'Context2'
]),
\
...
...
@@ -78,3 +80,9 @@ class TodoListTester(unittest.TestCase):
self
.
assertTrue
(
self
.
todolist
.
todo
(
1
).
is_completed
())
self
.
assertEquals
(
self
.
todolist
.
todo
(
1
).
source
(),
\
"x "
+
today
+
" Foo @Context1 Not@Context +Project1 Not+Project"
)
def
test_string
(
self
):
# readlines() always ends a string with \n, but join() in str(todolist)
# doesn't necessarily.
self
.
assertEquals
(
str
(
self
.
todolist
)
+
'
\
n
'
,
self
.
text
)
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