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
8e2e4fd1
Commit
8e2e4fd1
authored
Sep 29, 2015
by
Jacek Sowiński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for Filter.PriorityFilter
parent
2c5b7175
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
99 additions
and
0 deletions
+99
-0
test/FilterTest.py
test/FilterTest.py
+99
-0
No files found.
test/FilterTest.py
View file @
8e2e4fd1
...
@@ -374,6 +374,105 @@ class OrdinalTagFilterTest(TopydoTest):
...
@@ -374,6 +374,105 @@ class OrdinalTagFilterTest(TopydoTest):
self
.
assertEqual
(
len
(
result
),
1
)
self
.
assertEqual
(
len
(
result
),
1
)
self
.
assertEqual
(
result
[
0
].
source
(),
self
.
todo3
)
self
.
assertEqual
(
result
[
0
].
source
(),
self
.
todo3
)
class
PriorityFilterTest
(
TopydoTest
):
def
setUp
(
self
):
super
(
PriorityFilterTest
,
self
).
setUp
()
self
.
todo1
=
"(A) Foo"
self
.
todo2
=
"(B) Bar"
self
.
todo3
=
"(C) Baz"
self
.
todo4
=
"(Z) FooBar"
self
.
todo5
=
"FooBaz"
self
.
todos
=
[
Todo
(
self
.
todo1
),
Todo
(
self
.
todo2
),
Todo
(
self
.
todo3
),
Todo
(
self
.
todo4
),
Todo
(
self
.
todo5
),
]
def
test_filter1
(
self
):
pf
=
Filter
.
PriorityFilter
(
'(A)'
)
result
=
pf
.
filter
(
self
.
todos
)
self
.
assertEqual
(
len
(
result
),
1
)
self
.
assertEqual
(
result
[
0
].
source
(),
self
.
todo1
)
def
test_filter1a
(
self
):
pf
=
Filter
.
PriorityFilter
(
'(=A)'
)
result
=
pf
.
filter
(
self
.
todos
)
self
.
assertEqual
(
len
(
result
),
1
)
self
.
assertEqual
(
result
[
0
].
source
(),
self
.
todo1
)
def
test_filter2
(
self
):
pf
=
Filter
.
PriorityFilter
(
'(>B)'
)
result
=
pf
.
filter
(
self
.
todos
)
self
.
assertEqual
(
len
(
result
),
1
)
self
.
assertEqual
(
result
[
0
].
source
(),
self
.
todo1
)
def
test_filter3
(
self
):
pf
=
Filter
.
PriorityFilter
(
'(>=C)'
)
result
=
pf
.
filter
(
self
.
todos
)
self
.
assertEqual
(
len
(
result
),
3
)
self
.
assertEqual
(
result
[
0
].
source
(),
self
.
todo1
)
self
.
assertEqual
(
result
[
1
].
source
(),
self
.
todo2
)
self
.
assertEqual
(
result
[
2
].
source
(),
self
.
todo3
)
def
test_filter4
(
self
):
pf
=
Filter
.
PriorityFilter
(
'(<A)'
)
result
=
pf
.
filter
(
self
.
todos
)
self
.
assertEqual
(
len
(
result
),
4
)
self
.
assertEqual
(
result
[
0
].
source
(),
self
.
todo2
)
self
.
assertEqual
(
result
[
1
].
source
(),
self
.
todo3
)
self
.
assertEqual
(
result
[
2
].
source
(),
self
.
todo4
)
self
.
assertEqual
(
result
[
3
].
source
(),
self
.
todo5
)
def
test_filter5
(
self
):
pf
=
Filter
.
PriorityFilter
(
'(<=C)'
)
result
=
pf
.
filter
(
self
.
todos
)
self
.
assertEqual
(
len
(
result
),
3
)
self
.
assertEqual
(
result
[
0
].
source
(),
self
.
todo3
)
self
.
assertEqual
(
result
[
1
].
source
(),
self
.
todo4
)
self
.
assertEqual
(
result
[
2
].
source
(),
self
.
todo5
)
def
test_filter6
(
self
):
pf
=
Filter
.
PriorityFilter
(
'(!B)'
)
result
=
pf
.
filter
(
self
.
todos
)
self
.
assertEqual
(
len
(
result
),
4
)
self
.
assertEqual
(
result
[
0
].
source
(),
self
.
todo1
)
self
.
assertEqual
(
result
[
1
].
source
(),
self
.
todo3
)
self
.
assertEqual
(
result
[
2
].
source
(),
self
.
todo4
)
self
.
assertEqual
(
result
[
3
].
source
(),
self
.
todo5
)
def
test_filter7
(
self
):
pf
=
Filter
.
PriorityFilter
(
'(>A)'
)
result
=
pf
.
filter
(
self
.
todos
)
self
.
assertEqual
(
len
(
result
),
0
)
def
test_filter8
(
self
):
pf
=
Filter
.
PriorityFilter
(
'(<Z)'
)
result
=
pf
.
filter
(
self
.
todos
)
self
.
assertEqual
(
len
(
result
),
1
)
self
.
assertEqual
(
result
[
0
].
source
(),
self
.
todo5
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
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