mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	compatibility: Treat empty version as unknown, not old.
This commit is contained in:
		@@ -20,7 +20,10 @@ class VersionTest(ZulipTestCase):
 | 
			
		||||
        15.1.95  <  16.2.96
 | 
			
		||||
        16.2.96  =  16.2.96
 | 
			
		||||
        20.0.103 >  16.2.96
 | 
			
		||||
    '''.strip().split('\n')]
 | 
			
		||||
    '''.strip().split('\n')] + [
 | 
			
		||||
        ['', '?', '1'],
 | 
			
		||||
        ['', '?', 'a'],
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    def test_version_lt(self) -> None:
 | 
			
		||||
        for ver1, cmp, ver2 in self.data:
 | 
			
		||||
 
 | 
			
		||||
@@ -31,6 +31,8 @@ def version_lt(ver1: str, ver2: str) -> Optional[bool]:
 | 
			
		||||
    '''
 | 
			
		||||
    num1, rest1 = pop_numerals(ver1)
 | 
			
		||||
    num2, rest2 = pop_numerals(ver2)
 | 
			
		||||
    if not num1 or not num2:
 | 
			
		||||
        return None
 | 
			
		||||
    common_len = min(len(num1), len(num2))
 | 
			
		||||
    common_num1, rest_num1 = num1[:common_len], num1[common_len:]
 | 
			
		||||
    common_num2, rest_num2 = num2[:common_len], num2[common_len:]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user