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
54306e0e
Commit
54306e0e
authored
Nov 09, 2015
by
Jacek Sowiński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for each single placeholder
parent
00cac86e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
224 additions
and
0 deletions
+224
-0
test/test_list_format.py
test/test_list_format.py
+224
-0
No files found.
test/test_list_format.py
View file @
54306e0e
...
@@ -256,5 +256,229 @@ just now | in 2 days | in a day |
...
@@ -256,5 +256,229 @@ just now | in 2 days | in a day |
self
.
assertEqual
(
self
.
output
,
result
)
self
.
assertEqual
(
self
.
output
,
result
)
def
test_list_format15
(
self
):
command
=
ListCommand
([
"-x"
,
"-F"
,
"%c"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u"""2015-08-31
2015-11-03
2015-07-12
"""
self
.
assertEqual
(
self
.
output
,
result
)
def
test_list_format16
(
self
):
command
=
ListCommand
([
"-x"
,
"-F"
,
"%C"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u"""3 months ago
just now
4 months ago
"""
self
.
assertEqual
(
self
.
output
,
result
)
def
test_list_format17
(
self
):
command
=
ListCommand
([
"-x"
,
"-F"
,
"%d"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u"""2015-09-30
2015-11-05
"""
self
.
assertEqual
(
self
.
output
,
result
)
def
test_list_format18
(
self
):
command
=
ListCommand
([
"-x"
,
"-F"
,
"%D"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u"""a month ago
in 2 days
"""
self
.
assertEqual
(
self
.
output
,
result
)
def
test_list_format19
(
self
):
command
=
ListCommand
([
"-x"
,
"-F"
,
"%h"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u"""due a month ago, started a month ago
due in 2 days, starts in a day
"""
self
.
assertEqual
(
self
.
output
,
result
)
def
test_list_format20
(
self
):
command
=
ListCommand
([
"-x"
,
"-F"
,
"%H"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u"""3 months ago, due a month ago, started a month ago
just now, due in 2 days, starts in a day
4 months ago
"""
self
.
assertEqual
(
self
.
output
,
result
)
def
test_list_format21
(
self
):
command
=
ListCommand
([
"-x"
,
"-F"
,
"%i"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u"""1
2
3
4
5
6
"""
self
.
assertEqual
(
self
.
output
,
result
)
def
test_list_format22
(
self
):
command
=
ListCommand
([
"-x"
,
"-F"
,
"%I"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u""" 1
2
3
4
5
6
"""
self
.
assertEqual
(
self
.
output
,
result
)
def
test_list_format23
(
self
):
command
=
ListCommand
([
"-x"
,
"-F"
,
"%k"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u"""
lazy:bar
key:value
date:2014-12-12
"""
self
.
assertEqual
(
self
.
output
,
result
)
def
test_list_format24
(
self
):
command
=
ListCommand
([
"-x"
,
"-F"
,
"%K"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u"""due:2015-09-30 t:2015-09-29
due:2015-11-05 lazy:bar t:2015-11-04
key:value
ical:foobar id:1 p:2
date:2014-12-12
"""
self
.
assertEqual
(
self
.
output
,
result
)
def
test_list_format25
(
self
):
command
=
ListCommand
([
"-x"
,
"-F"
,
"%p"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u"""D
Z
C
C
"""
self
.
assertEqual
(
self
.
output
,
result
)
def
test_list_format26
(
self
):
command
=
ListCommand
([
"-x"
,
"-F"
,
"%s"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u"""Bar @Context1 +Project2
Lorem ipsum dolorem sit amet. Red @fox +jumped over the and jar
Foo @Context2 Not@Context +Project1 Not+Project
Baz @Context1 +Project1
Drink beer @ home
Completed but with
"""
self
.
assertEqual
(
self
.
output
,
result
)
@
mock
.
patch
(
'topydo.lib.PrettyPrinterFilter.get_terminal_size'
)
def
test_list_format27
(
self
,
mock_terminal_size
):
mock_terminal_size
.
return_value
=
self
.
terminal_size
(
50
,
25
)
command
=
ListCommand
([
"-x"
,
"-F"
,
"%S"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u"""Bar @Context1 +Project2
Lorem ipsum dolorem sit amet. Red @fox +jumped...
Foo @Context2 Not@Context +Project1 Not+Project
Baz @Context1 +Project1
Drink beer @ home
Completed but with
"""
self
.
assertEqual
(
self
.
output
,
result
)
def
test_list_format28
(
self
):
command
=
ListCommand
([
"-x"
,
"-F"
,
"%t"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u"""2015-09-29
2015-11-04
"""
self
.
assertEqual
(
self
.
output
,
result
)
def
test_list_format29
(
self
):
command
=
ListCommand
([
"-x"
,
"-F"
,
"%T"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u"""a month ago
in a day
"""
self
.
assertEqual
(
self
.
output
,
result
)
def
test_list_format30
(
self
):
command
=
ListCommand
([
"-x"
,
"-F"
,
"%x"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u"""
x 2014-12-12
"""
self
.
assertEqual
(
self
.
output
,
result
)
def
test_list_format31
(
self
):
command
=
ListCommand
([
"-x"
,
"-F"
,
"%X"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
result
=
u"""
x 11 months ago
"""
self
.
assertEqual
(
self
.
output
,
result
)
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