mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-03 06:58:42 +00:00
Fix VersionSplit comparison to do a proper compare and not simply
against the version strings
This commit is contained in:
parent
32a00d7919
commit
90103358f3
2 changed files with 21 additions and 10 deletions
|
@ -526,7 +526,7 @@ class VersionSplit(object):
|
|||
def __init__(self, ver):
|
||||
ver = ver.lower()
|
||||
vs = ver.split("_") if "_" in ver else ver.split("-")
|
||||
self.version = vs[0]
|
||||
self.version = [int(x) for x in vs[0].split(".")]
|
||||
self.suffix = None
|
||||
if len(vs) > 1:
|
||||
for s in ("rc", "alpha", "beta", "dev"):
|
||||
|
|
11
tests/test_versionsplit.py
Normal file
11
tests/test_versionsplit.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
from twisted.trial import unittest
|
||||
from deluge.common import VersionSplit
|
||||
|
||||
class VersionSplitTestClass(unittest.TestCase):
|
||||
def test_compare(self):
|
||||
vs1 = VersionSplit("0.14.9")
|
||||
vs2 = VersionSplit("0.14.10")
|
||||
vs3 = VersionSplit("0.14.5")
|
||||
|
||||
self.assertTrue(vs1 > vs3)
|
||||
self.assertTrue(vs2 > vs1)
|
Loading…
Add table
Add a link
Reference in a new issue