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
d9efdf83
Commit
d9efdf83
authored
Dec 12, 2014
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow any tag to have a date value.
Fixes a bug that ListCommand wouldn't show items matching key:2014-12-12
parent
d106c563
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
+13
-5
test/ListCommandTest.py
test/ListCommandTest.py
+9
-2
test/data/ListCommandTest.txt
test/data/ListCommandTest.txt
+1
-0
topydo/lib/Filter.py
topydo/lib/Filter.py
+3
-3
No files found.
test/ListCommandTest.py
View file @
d9efdf83
...
@@ -57,7 +57,7 @@ class ListCommandTest(CommandTest.CommandTest):
...
@@ -57,7 +57,7 @@ class ListCommandTest(CommandTest.CommandTest):
command
.
execute
()
command
.
execute
()
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertEquals
(
self
.
output
,
"| 1| (C) Foo @Context2 Not@Context +Project1 Not+Project
\
n
| 3| (C) Baz @Context1 +Project1 key:value id:1
\
n
| 4| (C) Drink beer @ home
\
n
| 5| (C) 13 + 29 = 42
\
n
| 2| (D) Bar @Context1 +Project2 p:1
\
n
"
)
self
.
assertEquals
(
self
.
output
,
"| 1| (C) Foo @Context2 Not@Context +Project1 Not+Project
\
n
| 3| (C) Baz @Context1 +Project1 key:value id:1
\
n
| 4| (C) Drink beer @ home
\
n
| 5| (C) 13 + 29 = 42
\
n
| 2| (D) Bar @Context1 +Project2 p:1
\
n
| 6| x 2014-12-12 Completed but with date:2014-12-12
\
n
"
)
self
.
assertEquals
(
self
.
errors
,
""
)
self
.
assertEquals
(
self
.
errors
,
""
)
def
test_list6
(
self
):
def
test_list6
(
self
):
...
@@ -125,7 +125,7 @@ class ListCommandTest(CommandTest.CommandTest):
...
@@ -125,7 +125,7 @@ class ListCommandTest(CommandTest.CommandTest):
command
.
execute
()
command
.
execute
()
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertEquals
(
self
.
output
,
"| 1| (C) Foo @Context2 Not@Context +Project1 Not+Project
\
n
| 3| (C) Baz @Context1 +Project1 key:value id:1
\
n
| 4| (C) Drink beer @ home
\
n
| 5| (C) 13 + 29 = 42
\
n
"
)
self
.
assertEquals
(
self
.
output
,
"| 1| (C) Foo @Context2 Not@Context +Project1 Not+Project
\
n
| 3| (C) Baz @Context1 +Project1 key:value id:1
\
n
| 4| (C) Drink beer @ home
\
n
| 5| (C) 13 + 29 = 42
\
n
| 6| x 2014-12-12 Completed but with date:2014-12-12
\
n
"
)
self
.
assertEquals
(
self
.
errors
,
""
)
self
.
assertEquals
(
self
.
errors
,
""
)
def
test_list14
(
self
):
def
test_list14
(
self
):
...
@@ -164,6 +164,13 @@ class ListCommandTest(CommandTest.CommandTest):
...
@@ -164,6 +164,13 @@ class ListCommandTest(CommandTest.CommandTest):
self
.
assertEquals
(
self
.
output
,
"| 3| (C) Baz @Context1 +Project1 key:value id:1
\
n
"
)
self
.
assertEquals
(
self
.
output
,
"| 3| (C) Baz @Context1 +Project1 key:value id:1
\
n
"
)
self
.
assertEquals
(
self
.
errors
,
""
)
self
.
assertEquals
(
self
.
errors
,
""
)
def
test_list18
(
self
):
command
=
ListCommand
([
"-x"
,
"date:2014-12-12"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
self
.
assertFalse
(
self
.
todolist
.
is_dirty
())
self
.
assertEquals
(
self
.
output
,
"| 6| x 2014-12-12 Completed but with date:2014-12-12
\
n
"
)
def
test_help
(
self
):
def
test_help
(
self
):
command
=
ListCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
=
ListCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
command
.
execute
()
...
...
test/data/ListCommandTest.txt
View file @
d9efdf83
...
@@ -4,3 +4,4 @@
...
@@ -4,3 +4,4 @@
(C) Drink beer @ home
(C) Drink beer @ home
(C) 13 + 29 = 42
(C) 13 + 29 = 42
x 2014-12-12 Completed but with date:2014-12-12
topydo/lib/Filter.py
View file @
d9efdf83
...
@@ -168,7 +168,7 @@ class OrdinalTagFilter(Filter):
...
@@ -168,7 +168,7 @@ class OrdinalTagFilter(Filter):
if not self.key or not p_todo.has_tag(self.key):
if not self.key or not p_todo.has_tag(self.key):
return False
return False
if self.key == config().tag_due() or self.key == config().tag_start()
:
try
:
operand1 = date_string_to_date(p_todo.tag_value(self.key))
operand1 = date_string_to_date(p_todo.tag_value(self.key))
operand2 = relative_date_to_date(self.value)
operand2 = relative_date_to_date(self.value)
...
@@ -176,8 +176,8 @@ class OrdinalTagFilter(Filter):
...
@@ -176,8 +176,8 @@ class OrdinalTagFilter(Filter):
operand2 = date_string_to_date(self.value)
operand2 = date_string_to_date(self.value)
if not operand1 or not operand2:
if not operand1 or not operand2:
r
eturn False
r
aise ValueError
e
lse
:
e
xcept ValueError
:
try:
try:
operand1 = int(p_todo.tag_value(self.key))
operand1 = int(p_todo.tag_value(self.key))
operand2 = int(self.value)
operand2 = int(self.value)
...
...
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