1
0
mirror of https://github.com/wting/autojump synced 2026-03-02 03:49:26 +00:00

adding option to decrease weight

added a new option, -d/--decrease to decrease the weight of a path.
added --increase as an alias to --add for symetry.
This commit is contained in:
Xavier Lepaul
2013-02-24 20:52:09 -08:00
parent 0a87804277
commit b8901586cb
2 changed files with 29 additions and 3 deletions

View File

@@ -53,6 +53,15 @@ class TestAutojump(unittest.TestCase):
self.db.add('/2', 10)
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('/2', 100)
self.db.add('/2', 42)
self.db.decrease('/2', 42)
self.assertEquals(self.db.get_weight('/2'), 100)
def test_db_get_weight(self):
self.assertEqual(self.db.get_weight('/'), 0)