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
59ba85de
Commit
59ba85de
authored
Jan 08, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly deal with after: before: tags when a textual ID was given.
parent
a4427f95
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
test/AddCommandTest.py
test/AddCommandTest.py
+13
-0
topydo/lib/AddCommand.py
topydo/lib/AddCommand.py
+2
-5
No files found.
test/AddCommandTest.py
View file @
59ba85de
...
@@ -18,6 +18,7 @@ from datetime import date
...
@@ -18,6 +18,7 @@ from datetime import date
from
topydo.lib
import
AddCommand
from
topydo.lib
import
AddCommand
import
CommandTest
import
CommandTest
from
topydo.lib.Config
import
config
from
topydo.lib
import
TodoList
from
topydo.lib
import
TodoList
class
AddCommandTest
(
CommandTest
.
CommandTest
):
class
AddCommandTest
(
CommandTest
.
CommandTest
):
...
@@ -157,6 +158,18 @@ class AddCommandTest(CommandTest.CommandTest):
...
@@ -157,6 +158,18 @@ class AddCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
todolist
.
todo
(
3
).
source
(),
self
.
today
+
" Baz id:1"
)
self
.
assertEquals
(
self
.
todolist
.
todo
(
3
).
source
(),
self
.
today
+
" Baz id:1"
)
self
.
assertEquals
(
self
.
errors
,
""
)
self
.
assertEquals
(
self
.
errors
,
""
)
def
test_add_dep8
(
self
):
config
(
"test/data/todolist-uid.conf"
)
command
=
AddCommand
.
AddCommand
([
"Foo"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
command
=
AddCommand
.
AddCommand
([
"Bar after:tpi"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
self
.
assertEquals
(
self
.
todolist
.
todo
(
'tpi'
).
source
(),
"{} Foo p:1"
.
format
(
self
.
today
))
self
.
assertEquals
(
self
.
todolist
.
todo
(
'b0n'
).
source
(),
"{} Bar id:1"
.
format
(
self
.
today
))
def
test_add_reldate1
(
self
):
def
test_add_reldate1
(
self
):
command
=
AddCommand
.
AddCommand
([
"Foo due:today"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
=
AddCommand
.
AddCommand
([
"Foo due:today"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
command
.
execute
()
...
...
topydo/lib/AddCommand.py
View file @
59ba85de
...
@@ -61,21 +61,18 @@ class AddCommand(Command):
...
@@ -61,21 +61,18 @@ class AddCommand(Command):
self
.
todo
.
set_tag
(
p_tag
,
dateobj
.
isoformat
())
self
.
todo
.
set_tag
(
p_tag
,
dateobj
.
isoformat
())
def
add_dependencies
(
p_tag
):
def
add_dependencies
(
p_tag
):
for
raw_
value
in
self
.
todo
.
tag_values
(
p_tag
):
for
value
in
self
.
todo
.
tag_values
(
p_tag
):
try
:
try
:
value
=
int
(
raw_value
)
dep
=
self
.
todolist
.
todo
(
value
)
dep
=
self
.
todolist
.
todo
(
value
)
if
p_tag
==
'after'
:
if
p_tag
==
'after'
:
self
.
todolist
.
add_dependency
(
self
.
todo
,
dep
)
self
.
todolist
.
add_dependency
(
self
.
todo
,
dep
)
elif
p_tag
==
'before'
or
p_tag
==
'partof'
:
elif
p_tag
==
'before'
or
p_tag
==
'partof'
:
self
.
todolist
.
add_dependency
(
dep
,
self
.
todo
)
self
.
todolist
.
add_dependency
(
dep
,
self
.
todo
)
except
ValueError
:
continue
except
InvalidTodoException
:
except
InvalidTodoException
:
pass
pass
self
.
todo
.
remove_tag
(
p_tag
,
raw_
value
)
self
.
todo
.
remove_tag
(
p_tag
,
value
)
convert_date
(
config
().
tag_start
())
convert_date
(
config
().
tag_start
())
convert_date
(
config
().
tag_due
())
convert_date
(
config
().
tag_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