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
0980d459
Commit
0980d459
authored
Dec 03, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #84 from MinchinWeb/lowercase-priorities
Priority command: allow lowercase priorities to be input
parents
93544521
9b855ec7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
test/test_priority_command.py
test/test_priority_command.py
+10
-0
topydo/commands/PriorityCommand.py
topydo/commands/PriorityCommand.py
+2
-2
No files found.
test/test_priority_command.py
View file @
0980d459
...
...
@@ -91,6 +91,16 @@ class PriorityCommandTest(CommandTest):
self
.
assertEqual
(
self
.
output
,
"Priority changed from A to C
\
n
| 1| (C) Foo
\
n
Priority set to C.
\
n
| 2| (C) Bar
\
n
"
)
self
.
assertEqual
(
self
.
errors
,
""
)
def
test_set_prio7
(
self
):
""" Allow lowercase priority to be set. """
command
=
PriorityCommand
([
"Foo"
,
"2"
,
"c"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
self
.
assertTrue
(
self
.
todolist
.
is_dirty
())
self
.
assertEqual
(
self
.
output
,
"Priority changed from A to C
\
n
| 1| (C) Foo
\
n
Priority set to C.
\
n
| 2| (C) Bar
\
n
"
)
self
.
assertEqual
(
self
.
errors
,
""
)
def
test_expr_prio1
(
self
):
command
=
PriorityCommand
([
"-e"
,
"@test"
,
"C"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
None
)
...
...
topydo/commands/PriorityCommand.py
View file @
0980d459
...
...
@@ -22,7 +22,7 @@ from topydo.lib.Utils import is_valid_priority
class
PriorityCommand
(
MultiCommand
):
def
__init__
(
self
,
p_args
,
p_todolist
,
#
pragma: no branch
def
__init__
(
self
,
p_args
,
p_todolist
,
#
pragma: no branch
p_out
=
lambda
a
:
None
,
p_err
=
lambda
a
:
None
,
p_prompt
=
lambda
a
:
None
):
...
...
@@ -33,7 +33,7 @@ class PriorityCommand(MultiCommand):
def
_execute_multi_specific
(
self
):
def
normalize_priority
(
p_priority
):
match
=
re
.
search
(
r'\b([A-Z])\b'
,
p_priority
)
match
=
re
.
search
(
r'\b([A-Z])\b'
,
p_priority
.
upper
()
)
return
match
.
group
(
1
)
if
match
else
p_priority
priority
=
normalize_priority
(
self
.
args
[
-
1
])
...
...
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