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
5b3784a7
Commit
5b3784a7
authored
Nov 09, 2015
by
Jacek Sowiński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test ignore_weekends clause in Importance
Also introduce freezegun.freeze_time decorator.
parent
b76b1dbd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
13 deletions
+16
-13
setup.py
setup.py
+1
-1
test/test_importance.py
test/test_importance.py
+15
-12
No files found.
setup.py
View file @
5b3784a7
...
@@ -37,7 +37,7 @@ setup(
...
@@ -37,7 +37,7 @@ setup(
':python_version=="2.7"'
:
[
'ushlex'
],
':python_version=="2.7"'
:
[
'ushlex'
],
'ical'
:
[
'icalendar'
],
'ical'
:
[
'icalendar'
],
'prompt-toolkit'
:
[
'prompt-toolkit >= 0.53'
],
'prompt-toolkit'
:
[
'prompt-toolkit >= 0.53'
],
'test'
:
[
'
green'
,
'coverage
'
],
'test'
:
[
'
freezegun'
,
'coverage'
,
'green
'
],
'test:python_version=="2.7"'
:
[
'mock'
],
'test:python_version=="2.7"'
:
[
'mock'
],
'test:python_version!="3.2"'
:
[
'pylint'
],
'test:python_version!="3.2"'
:
[
'pylint'
],
},
},
...
...
test/test_importance.py
View file @
5b3784a7
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
import
unittest
import
unittest
from
datetime
import
date
,
timedelta
from
datetime
import
date
,
timedelta
from
freezegun
import
freeze_time
from
test.topydo_testcase
import
TopydoTest
from
test.topydo_testcase
import
TopydoTest
from
topydo.lib.Config
import
config
from
topydo.lib.Config
import
config
...
@@ -23,35 +24,37 @@ from topydo.lib.Importance import importance
...
@@ -23,35 +24,37 @@ from topydo.lib.Importance import importance
from
topydo.lib.Todo
import
Todo
from
topydo.lib.Todo
import
Todo
@
freeze_time
(
"2015, 11, 06"
)
class
ImportanceTest
(
TopydoTest
):
class
ImportanceTest
(
TopydoTest
):
def
test_importance1
(
self
):
def
test_importance
0
1
(
self
):
todo
=
Todo
(
"Foo"
)
todo
=
Todo
(
"Foo"
)
self
.
assertEqual
(
importance
(
todo
),
2
)
self
.
assertEqual
(
importance
(
todo
),
2
)
def
test_importance2
(
self
):
def
test_importance
0
2
(
self
):
todo
=
Todo
(
"(A) Foo"
)
todo
=
Todo
(
"(A) Foo"
)
self
.
assertEqual
(
importance
(
todo
),
5
)
self
.
assertEqual
(
importance
(
todo
),
5
)
def
test_importance3
(
self
):
def
test_importance
0
3
(
self
):
todo
=
Todo
(
"(A) Foo "
+
config
().
tag_star
()
+
":1"
)
todo
=
Todo
(
"(A) Foo "
+
config
().
tag_star
()
+
":1"
)
self
.
assertEqual
(
importance
(
todo
),
6
)
self
.
assertEqual
(
importance
(
todo
),
6
)
def
test_importance4
(
self
):
def
test_importance
0
4
(
self
):
today_str
=
date
.
today
().
isoformat
()
today_str
=
date
.
today
().
isoformat
()
todo
=
Todo
(
"(C) Foo "
+
config
().
tag_due
()
+
":"
+
today_str
)
todo
=
Todo
(
"(C) Foo "
+
config
().
tag_due
()
+
":"
+
today_str
)
self
.
assertEqual
(
importance
(
todo
),
8
)
self
.
assertEqual
(
importance
(
todo
),
8
)
def
test_importance5
(
self
):
def
test_importance05
(
self
):
due
=
date
.
today
()
+
timedelta
(
8
)
todo
=
Todo
(
"(C) Foo "
+
config
().
tag_due
()
+
":"
+
"2015-11-14"
)
due_str
=
due
.
isoformat
()
todo
=
Todo
(
"(C) Foo "
+
config
().
tag_due
()
+
":"
+
due_str
)
self
.
assertEqual
(
importance
(
todo
),
4
)
self
.
assertEqual
(
importance
(
todo
),
4
)
def
test_importance6
(
self
):
def
test_importance06
(
self
):
due
=
date
.
today
()
+
timedelta
(
4
)
todo
=
Todo
(
"(C) Foo "
+
config
().
tag_due
()
+
":"
+
"2015-11-10"
)
due_str
=
due
.
isoformat
()
todo
=
Todo
(
"(C) Foo "
+
config
().
tag_due
()
+
":"
+
due_str
)
self
.
assertEqual
(
importance
(
todo
),
5
)
self
.
assertEqual
(
importance
(
todo
),
5
)
def
test_importance07
(
self
):
config
(
p_overrides
=
{(
'sort'
,
'ignore_weekends'
):
'1'
})
todo
=
Todo
(
"(C) Foo "
+
config
().
tag_due
()
+
":"
+
"2015-11-09"
)
self
.
assertEqual
(
importance
(
todo
),
6
)
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