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
80114fff
Commit
80114fff
authored
Nov 18, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into colorblock
parents
f97a19f6
54db080a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
test/test_todo.py
test/test_todo.py
+24
-0
topydo/lib/Todo.py
topydo/lib/Todo.py
+3
-2
No files found.
test/test_todo.py
View file @
80114fff
...
...
@@ -90,5 +90,29 @@ class TodoTest(TopydoTest):
todo
=
Todo
(
"(C) Foo t:2014-01-01 due:2014-01-02"
)
self
.
assertEqual
(
todo
.
length
(),
1
)
def
test_length4
(
self
):
todo
=
Todo
(
"(C) Foo)"
)
self
.
assertEqual
(
todo
.
length
(),
0
)
def
test_length5
(
self
):
todo
=
Todo
(
"(C) 2015-11-18 Foo)"
)
self
.
assertEqual
(
todo
.
length
(),
0
)
def
test_length6
(
self
):
todo
=
Todo
(
"(C) 2015-11-18 Foo due:2015-11-19)"
)
self
.
assertEqual
(
todo
.
length
(),
1
)
def
test_length7
(
self
):
todo
=
Todo
(
"(C) 2015-11-18 Foo due:2015-11-18)"
)
self
.
assertEqual
(
todo
.
length
(),
0
)
def
test_length8
(
self
):
todo
=
Todo
(
"(C) 2015-11-18 Foo t:2015-11-19 due:2015-11-20)"
)
self
.
assertEqual
(
todo
.
length
(),
1
)
def
test_length9
(
self
):
todo
=
Todo
(
"(C) 2015-11-18 Foo due:2015-11-16)"
)
self
.
assertEqual
(
todo
.
length
(),
0
)
if
__name__
==
'__main__'
:
unittest
.
main
()
topydo/lib/Todo.py
View file @
80114fff
...
...
@@ -85,9 +85,10 @@ class Todo(TodoBase):
def
length
(
self
):
"""
Returns the length (in days) of the task, by considering the start date
and the due date. Returns 0 when one of these dates are missing.
and the due date. When there is no start date, its creation date is
used. Returns 0 when one of these dates is missing.
"""
start
=
self
.
start_date
()
start
=
self
.
start_date
()
or
self
.
creation_date
()
due
=
self
.
due_date
()
if
start
and
due
and
start
<
due
:
...
...
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