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
674947f4
Commit
674947f4
authored
Nov 29, 2014
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly deal with integers passed as expression.
Conflicts: test/FilterTest.py
parent
8e32cf75
Changes
2
Show 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 @
674947f4
...
@@ -185,6 +185,13 @@ class FilterTest(unittest.TestCase):
...
@@ -185,6 +185,13 @@ class FilterTest(unittest.TestCase):
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter19
(
self
):
def
test_filter19
(
self
):
todos
=
load_file
(
'data/FilterTest1.txt'
)
grep
=
Filter
.
GrepFilter
(
1
)
filtered_todos
=
grep
.
filter
(
todos
)
self
.
assertEquals
(
filtered_todos
,
[])
def
test_filter20
(
self
):
todos
=
load_file
(
'data/FilterTest3.txt'
)
todos
=
load_file
(
'data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'due:<2014-11-10'
)
otf
=
Filter
.
OrdinalTagFilter
(
'due:<2014-11-10'
)
...
@@ -194,7 +201,7 @@ class FilterTest(unittest.TestCase):
...
@@ -194,7 +201,7 @@ class FilterTest(unittest.TestCase):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
\
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
\
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter2
0
(
self
):
def
test_filter2
1
(
self
):
todos
=
load_file
(
'data/FilterTest3.txt'
)
todos
=
load_file
(
'data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'due:=2014-11-10'
)
otf
=
Filter
.
OrdinalTagFilter
(
'due:=2014-11-10'
)
...
@@ -202,7 +209,7 @@ class FilterTest(unittest.TestCase):
...
@@ -202,7 +209,7 @@ class FilterTest(unittest.TestCase):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
""
)
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
""
)
def
test_filter2
1
(
self
):
def
test_filter2
2
(
self
):
todos
=
load_file
(
'data/FilterTest3.txt'
)
todos
=
load_file
(
'data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'due:=2014-11-10'
)
otf
=
Filter
.
OrdinalTagFilter
(
'due:=2014-11-10'
)
...
@@ -210,7 +217,7 @@ class FilterTest(unittest.TestCase):
...
@@ -210,7 +217,7 @@ class FilterTest(unittest.TestCase):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
""
)
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
""
)
def
test_filter2
2
(
self
):
def
test_filter2
3
(
self
):
todos
=
load_file
(
'data/FilterTest3.txt'
)
todos
=
load_file
(
'data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'due:=2014-11-99'
)
otf
=
Filter
.
OrdinalTagFilter
(
'due:=2014-11-99'
)
...
@@ -218,7 +225,7 @@ class FilterTest(unittest.TestCase):
...
@@ -218,7 +225,7 @@ class FilterTest(unittest.TestCase):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
""
)
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
""
)
def
test_filter2
3
(
self
):
def
test_filter2
4
(
self
):
todos
=
load_file
(
'data/FilterTest3.txt'
)
todos
=
load_file
(
'data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'due:=garbage'
)
otf
=
Filter
.
OrdinalTagFilter
(
'due:=garbage'
)
...
@@ -226,7 +233,7 @@ class FilterTest(unittest.TestCase):
...
@@ -226,7 +233,7 @@ class FilterTest(unittest.TestCase):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
""
)
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
""
)
def
test_filter2
4
(
self
):
def
test_filter2
5
(
self
):
todos
=
load_file
(
'data/FilterTest3.txt'
)
todos
=
load_file
(
'data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:<10'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:<10'
)
...
@@ -236,7 +243,7 @@ class FilterTest(unittest.TestCase):
...
@@ -236,7 +243,7 @@ class FilterTest(unittest.TestCase):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter2
5
(
self
):
def
test_filter2
6
(
self
):
todos
=
load_file
(
'data/FilterTest3.txt'
)
todos
=
load_file
(
'data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:<=16'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:<=16'
)
...
@@ -246,7 +253,7 @@ class FilterTest(unittest.TestCase):
...
@@ -246,7 +253,7 @@ class FilterTest(unittest.TestCase):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter2
6
(
self
):
def
test_filter2
7
(
self
):
todos
=
load_file
(
'data/FilterTest3.txt'
)
todos
=
load_file
(
'data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:<16'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:<16'
)
...
@@ -256,7 +263,7 @@ class FilterTest(unittest.TestCase):
...
@@ -256,7 +263,7 @@ class FilterTest(unittest.TestCase):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter2
7
(
self
):
def
test_filter2
8
(
self
):
todos
=
load_file
(
'data/FilterTest3.txt'
)
todos
=
load_file
(
'data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:<16a'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:<16a'
)
...
@@ -264,7 +271,7 @@ class FilterTest(unittest.TestCase):
...
@@ -264,7 +271,7 @@ class FilterTest(unittest.TestCase):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
""
)
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
""
)
def
test_filter2
8
(
self
):
def
test_filter2
9
(
self
):
todos
=
load_file
(
'data/FilterTest3.txt'
)
todos
=
load_file
(
'data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:>8'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:>8'
)
...
@@ -274,7 +281,7 @@ class FilterTest(unittest.TestCase):
...
@@ -274,7 +281,7 @@ class FilterTest(unittest.TestCase):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter
29
(
self
):
def
test_filter
30
(
self
):
todos
=
load_file
(
'data/FilterTest3.txt'
)
todos
=
load_file
(
'data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:>=8'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:>=8'
)
...
@@ -284,7 +291,7 @@ class FilterTest(unittest.TestCase):
...
@@ -284,7 +291,7 @@ class FilterTest(unittest.TestCase):
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
self
.
assertEquals
(
todolist_to_string
(
filtered_todos
),
todolist_to_string
(
reference
))
todolist_to_string
(
reference
))
def
test_filter3
0
(
self
):
def
test_filter3
1
(
self
):
todos
=
load_file
(
'data/FilterTest3.txt'
)
todos
=
load_file
(
'data/FilterTest3.txt'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:>-8'
)
otf
=
Filter
.
OrdinalTagFilter
(
'value:>-8'
)
...
...
topydo/lib/Filter.py
View file @
674947f4
...
@@ -62,7 +62,8 @@ class GrepFilter(Filter):
...
@@ -62,7 +62,8 @@ class GrepFilter(Filter):
def
__init__
(
self
,
p_expression
,
p_case_sensitive
=
None
):
def
__init__
(
self
,
p_expression
,
p_case_sensitive
=
None
):
super
(
GrepFilter
,
self
).
__init__
()
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
:
if
p_case_sensitive
!=
None
:
self
.
case_sensitive
=
p_case_sensitive
self
.
case_sensitive
=
p_case_sensitive
...
@@ -70,7 +71,7 @@ class GrepFilter(Filter):
...
@@ -70,7 +71,7 @@ class GrepFilter(Filter):
# only be case sensitive when the expression contains at least one
# only be case sensitive when the expression contains at least one
# capital character.
# capital character.
self
.
case_sensitive
=
\
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
):
def
match
(
self
,
p_todo
):
expr
=
self
.
expression
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