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
d7f4cbcf
Commit
d7f4cbcf
authored
Nov 09, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #73 from mruwek/ls-format
Update tests for ls_format
parents
edf0470b
2ec065b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
234 additions
and
13 deletions
+234
-13
test/data/ListFormat.txt
test/data/ListFormat.txt
+1
-1
test/test_list_format.py
test/test_list_format.py
+233
-12
No files found.
test/data/ListFormat.txt
View file @
d7f4cbcf
(D) 2015-08-31 Bar @Context1 +Project2 due:2015-09-30 t:2015-09-29
(Z) 2015-11-0
3 Lorem ipsum dolorem sit amet. Red @fox +jumped over the lazy:bar and jar due:2015-11-05 t:2015-11-04
(Z) 2015-11-0
6 Lorem ipsum dolorem sit amet. Red @fox +jumped over the lazy:bar and jar due:2015-11-08 t:2015-11-07
(C) 2015-07-12 Foo @Context2 Not@Context +Project1 Not+Project
(C) Baz @Context1 +Project1 key:value
Drink beer @ home id:1 p:2 ical:foobar
...
...
test/test_list_format.py
View file @
d7f4cbcf
...
...
@@ -31,6 +31,7 @@ try:
except
ImportError
:
import
mock
@
freeze_time
(
"2015, 11, 06"
)
class
ListFormatTest
(
CommandTest
):
def
setUp
(
self
):
super
(
ListFormatTest
,
self
).
setUp
()
...
...
@@ -43,7 +44,7 @@ class ListFormatTest(CommandTest):
command
.
execute
()
result
=
u"""| 1| (D) 2015-08-31 Bar @Context1 +Project2 due:2015-09-30 t:2015-09-29
| 2| (Z) 2015-11-0
3 Lorem ipsum dolorem sit amet. Red @fox +jumped over the and jar due:2015-11-05 lazy:bar t:2015-11-04
| 2| (Z) 2015-11-0
6 Lorem ipsum dolorem sit amet. Red @fox +jumped over the and jar due:2015-11-08 lazy:bar t:2015-11-07
| 3| (C) 2015-07-12 Foo @Context2 Not@Context +Project1 Not+Project
| 4| (C) Baz @Context1 +Project1 key:value
| 5| Drink beer @ home ical:foobar id:1 p:2
...
...
@@ -60,7 +61,7 @@ class ListFormatTest(CommandTest):
command
.
execute
()
result
=
u"""| 1| (D) 2015-08-31 Bar @Context1 +Project2 due:2015-09-30 t:2015-09-29
| 2| (Z) 2015-11-0
3 Lorem ipsum dolore... due:2015-11-05 lazy:bar t:2015-11-04
| 2| (Z) 2015-11-0
6 Lorem ipsum dolore... due:2015-11-08 lazy:bar t:2015-11-07
| 3| (C) 2015-07-12 Foo @Context2 Not@Context +Project1 Not+Project
| 4| (C) Baz @Context1 +Project1 key:value
| 5| Drink beer @ home ical:foobar id:1 p:2
...
...
@@ -77,7 +78,7 @@ class ListFormatTest(CommandTest):
command
.
execute
()
result
=
u"""| 1| (D) 2015-08-31 Bar @Context1 +Project2 due:2015-09-30 t:2015-09-29
| 2| (Z) 2015-11-0
3 Lorem ipsum dolorem sit amet. Red @fox... due:2015-11-05 lazy:bar t:2015-11-04
| 2| (Z) 2015-11-0
6 Lorem ipsum dolorem sit amet. Red @fox... due:2015-11-08 lazy:bar t:2015-11-07
| 3| (C) 2015-07-12 Foo @Context2 Not@Context +Project1 Not+Project
| 4| (C) Baz @Context1 +Project1 key:value
| 5| Drink beer @ home ical:foobar id:1 p:2
...
...
@@ -94,7 +95,7 @@ class ListFormatTest(CommandTest):
command
.
execute
()
result
=
u"""| 1| (D) 2015-08-31 Bar @Context1 +Project2 due:2015-09-30 t:2015-09-29
| 2| (Z) 2015-11-0
3 Lorem ipsum dolorem sit amet. Red @fox... due:2015-11-05 lazy:bar t:2015-11-04
| 2| (Z) 2015-11-0
6 Lorem ipsum dolorem sit amet. Red @fox... due:2015-11-08 lazy:bar t:2015-11-07
| 3| (C) 2015-07-12 Foo @Context2 Not@Context +Project1 Not+Project
| 4| (C) Baz @Context1 +Project1 key:value
| 5| Drink beer @ home ical:foobar id:1 p:2
...
...
@@ -111,14 +112,13 @@ class ListFormatTest(CommandTest):
command
.
execute
()
result
=
u"""| 1| (D) 2015-08-31 Bar @Context1 +Project2 due:2015-09-30 t:2015-09-29
| 2| (Z) 2015-11-0
3 Lorem ipsum dolore... due:2015-11-05 lazy:bar t:2015-11-04
| 2| (Z) 2015-11-0
6 Lorem ipsum dolore... due:2015-11-08 lazy:bar t:2015-11-07
| 3| (C) 2015-07-12 Foo @Context2 Not@Context +Project1 Not+Project
| 4| (C) Baz @Context1 +Project1 key:value
| 5| Drink beer @ home ical:foobar id:1 p:2
| 6| x 2014-12-12 Completed but with date:2014-12-12
"""
@
freeze_time
(
"2015, 11, 03"
)
@
mock
.
patch
(
'topydo.lib.PrettyPrinterFilter.get_terminal_size'
)
def
test_list_format06
(
self
,
mock_terminal_size
):
mock_terminal_size
.
return_value
=
self
.
terminal_size
(
100
,
25
)
...
...
@@ -136,7 +136,6 @@ class ListFormatTest(CommandTest):
"""
self
.
assertEqual
(
self
.
output
,
result
)
@
freeze_time
(
"2015, 11, 03"
)
@
mock
.
patch
(
'topydo.lib.PrettyPrinterFilter.get_terminal_size'
)
def
test_list_format07
(
self
,
mock_terminal_size
):
mock_terminal_size
.
return_value
=
self
.
terminal_size
(
100
,
25
)
...
...
@@ -154,7 +153,6 @@ class ListFormatTest(CommandTest):
"""
self
.
assertEqual
(
self
.
output
,
result
)
@
freeze_time
(
"2015, 11, 03"
)
@
mock
.
patch
(
'topydo.lib.PrettyPrinterFilter.get_terminal_size'
)
def
test_list_format08
(
self
,
mock_terminal_size
):
mock_terminal_size
.
return_value
=
self
.
terminal_size
(
100
,
25
)
...
...
@@ -164,7 +162,7 @@ class ListFormatTest(CommandTest):
command
.
execute
()
result
=
u"""2015-08-31 2015-09-30 2015-09-29
2015-11-0
3 2015-11-05 2015-11-04
2015-11-0
6 2015-11-08 2015-11-07
2015-07-12
...
...
@@ -172,7 +170,6 @@ x 2014-12-12
"""
self
.
assertEqual
(
self
.
output
,
result
)
@
freeze_time
(
"2015, 11, 03"
)
@
mock
.
patch
(
'topydo.lib.PrettyPrinterFilter.get_terminal_size'
)
def
test_list_format09
(
self
,
mock_terminal_size
):
mock_terminal_size
.
return_value
=
self
.
terminal_size
(
100
,
25
)
...
...
@@ -210,7 +207,7 @@ just now | in 2 days | in a day |
command
.
execute
()
result
=
u"""| 1| due:2015-09-30 t:2015-09-29
| 2| due:2015-11-0
5 lazy:bar t:2015-11-04
| 2| due:2015-11-0
8 lazy:bar t:2015-11-07
| 3|
| 4| key:value
| 5| ical:foobar id:1 p:2
...
...
@@ -238,7 +235,7 @@ just now | in 2 days | in a day |
command
.
execute
()
result
=
u"""| 1| (D) 2015-08-31 Bar @Context1 +Project2 due:2015-09-30 t:2015-09-29
| 2| (Z) 2015-11-0
3 Lorem ipsum dolorem sit amet. Red @fox +jumped over the and jar due:2015-11-05 lazy:bar t:2015-11-04
| 2| (Z) 2015-11-0
6 Lorem ipsum dolorem sit amet. Red @fox +jumped over the and jar due:2015-11-08 lazy:bar t:2015-11-07
| 3| (C) 2015-07-12 Foo @Context2 Not@Context +Project1 Not+Project
| 4| (C) Baz @Context1 +Project1 key:value
| 5| Drink beer @ home ical:foobar id:1 p:2
...
...
@@ -259,5 +256,229 @@ just now | in 2 days | in a day |
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-06
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-08
"""
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-08 lazy:bar t:2015-11-07
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-07
"""
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__'
:
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