Commit e93393b9 authored by Bram Schoenmakers's avatar Bram Schoenmakers

When new priority is the same, don't print it has changed.

parent 958398e1
# Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 Bram Schoenmakers <me@bramschoenmakers.nl>
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
......@@ -51,6 +51,13 @@ class PriorityCommandTest(CommandTest.CommandTest):
self.assertEquals(self.output, "Priority changed from A to B\n(B) Foo\n")
self.assertEquals(self.errors, "")
def test_set_prio4(self):
command = PriorityCommand.PriorityCommand(["1", "A"], self.todolist, self.out, self.error)
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertEquals(self.output, "(A) Foo\n")
self.assertEquals(self.errors, "")
def test_invalid1(self):
command = PriorityCommand.PriorityCommand(["99", "A"], self.todolist, self.out, self.error)
......
# Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 Bram Schoenmakers <me@bramschoenmakers.nl>
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
......@@ -41,9 +41,9 @@ class PriorityCommand(Command):
old_priority = todo.priority()
self.todolist.set_priority(todo, priority)
if old_priority and priority:
if old_priority and priority and old_priority != priority:
self.out("Priority changed from %s to %s" % (old_priority, priority))
else:
elif not old_priority:
self.out("Priority set to %s." % priority)
self.out(pretty_print(todo))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment