From 6f887a2000860e353da105ef690d6858eeb920ae Mon Sep 17 00:00:00 2001 From: William Ting Date: Sun, 24 Feb 2013 23:55:29 -0600 Subject: [PATCH] fix unit tests to match new decrease calculation --- bin/autojump | 7 ++++--- tests/runtests.py | 11 +++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/autojump b/bin/autojump index dbceb4e..664691a 100755 --- a/bin/autojump +++ b/bin/autojump @@ -239,14 +239,15 @@ def options(): directory passed as an argument.', epilog="Please see autojump(1) man pages for full documentation.") parser.add_argument( - 'directory', metavar='DIR', nargs='*', default='', + 'directory', metavar='DIRECTORY', nargs='*', default='', help='directory to jump to') parser.add_argument( - '-a', '--add', '--increase', metavar='DIR', + '-a', '--add', '--increase', metavar='DIRECTORY', help='manually add path to database, or increase path weight for \ existing paths') parser.add_argument( - '-d', '--decrease', nargs='?', type=int, const=15, default=False, + '-d', '--decrease', metavar='WEIGHT', nargs='?', type=int, + const=15, default=False, help='manually decrease path weight in database') parser.add_argument( '-b', '--bash', action="store_true", default=False, diff --git a/tests/runtests.py b/tests/runtests.py index b80f314..3bfb3cb 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -54,13 +54,12 @@ class TestAutojump(unittest.TestCase): self.assertEqual(self.db.get_weight('/2'), 14.142135623730951) def test_db_decrease(self): - self.db.add('/1', 100) - self.db.decrease('/a', 42) - self.assertTrue(self.db.get_weight('/a') < 100) + self.db.add('/1', 10) + self.db.decrease('/1', 50) + self.assertEquals(self.db.get_weight('/1'), 0) self.db.add('/2', 100) - self.db.add('/2', 42) - self.db.decrease('/2', 42) - self.assertEquals(self.db.get_weight('/2'), 100) + self.db.decrease('/2', 50) + self.assertEquals(self.db.get_weight('/2'), 50) def test_db_get_weight(self): self.assertEqual(self.db.get_weight('/'), 0)