mirror of
				https://github.com/wting/autojump
				synced 2025-06-13 12:54:07 +00:00 
			
		
		
		
	fix unit tests to match new decrease calculation
This commit is contained in:
		
							parent
							
								
									79cf76bcf5
								
							
						
					
					
						commit
						6f887a2000
					
				@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user