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
59452903
Commit
59452903
authored
Nov 29, 2014
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly deal with integers passed as expression.
parent
37aba451
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
13 deletions
+21
-13
test/FilterTest.py
test/FilterTest.py
+18
-11
topydo/lib/Filter.py
topydo/lib/Filter.py
+3
-2
No files found.
test/FilterTest.py
View file @
59452903
...
...
@@ -186,6 +186,13 @@ class FilterTest(TopydoTest.TopydoTest):
todolist_to_string
(
reference
))
def
test_filter19
(
self
):
todos
=
load_file
(
'test/data/FilterTest1.txt'
)
grep
=
Filter
.
GrepFilter
(
1
)
filtered_todos
=
grep
.
filter
(
todos
)
self
.
assertEquals
(
filtered_todos
,
[])
def
test_filter20
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'due:<2014-11-10'
)
...
...
@@ -195,7 +202,7 @@ class FilterTest(TopydoTest.TopydoTest):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
\
todolist_to_string
(
reference
))
def
test_filter2
0
(
self
):
def
test_filter2
1
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'due:=2014-11-10'
)
...
...
@@ -203,7 +210,7 @@ class FilterTest(TopydoTest.TopydoTest):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
""
)
def
test_filter2
1
(
self
):
def
test_filter2
2
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'due:=2014-11-10'
)
...
...
@@ -211,7 +218,7 @@ class FilterTest(TopydoTest.TopydoTest):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
""
)
def
test_filter2
2
(
self
):
def
test_filter2
3
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'due:=2014-11-99'
)
...
...
@@ -219,7 +226,7 @@ class FilterTest(TopydoTest.TopydoTest):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
""
)
def
test_filter2
3
(
self
):
def
test_filter2
4
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'due:=garbage'
)
...
...
@@ -227,7 +234,7 @@ class FilterTest(TopydoTest.TopydoTest):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
""
)
def
test_filter2
4
(
self
):
def
test_filter2
5
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:<10'
)
...
...
@@ -237,7 +244,7 @@ class FilterTest(TopydoTest.TopydoTest):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
def
test_filter2
5
(
self
):
def
test_filter2
6
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:<=16'
)
...
...
@@ -247,7 +254,7 @@ class FilterTest(TopydoTest.TopydoTest):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
def
test_filter2
6
(
self
):
def
test_filter2
7
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:<16'
)
...
...
@@ -257,7 +264,7 @@ class FilterTest(TopydoTest.TopydoTest):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
def
test_filter2
7
(
self
):
def
test_filter2
8
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:<16a'
)
...
...
@@ -265,7 +272,7 @@ class FilterTest(TopydoTest.TopydoTest):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
""
)
def
test_filter2
8
(
self
):
def
test_filter2
9
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:>8'
)
...
...
@@ -275,7 +282,7 @@ class FilterTest(TopydoTest.TopydoTest):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
def
test_filter
29
(
self
):
def
test_filter
30
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:>=8'
)
...
...
@@ -285,7 +292,7 @@ class FilterTest(TopydoTest.TopydoTest):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
def
test_filter3
0
(
self
):
def
test_filter3
1
(
self
):
todos
=
load_file
(
'test/data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:>-8'
)
...
...
topydo/lib/Filter.py
View file @
59452903
...
...
@@ -62,7 +62,8 @@ class GrepFilter(Filter):
def
__init__
(
self
,
p_expression
,
p_case_sensitive
=
None
):
super
(
GrepFilter
,
self
).
__init__
()
self
.
expression
=
p_expression
# convert to string in case we receive integers
self
.
expression
=
str
(
p_expression
)
if
p_case_sensitive
!=
None
:
self
.
case_sensitive
=
p_case_sensitive
...
...
@@ -70,7 +71,7 @@ class GrepFilter(Filter):
# only be case sensitive when the expression contains at least one
# capital character.
self
.
case_sensitive
=
\
len
([
c
for
c
in
p_
expression
if
c
.
isupper
()])
>
0
len
([
c
for
c
in
self
.
expression
if
c
.
isupper
()])
>
0
def
match
(
self
,
p_todo
):
expr
=
self
.
expression
...
...
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