55import adblock
66
77
8+ def parse_version (version ):
9+ parts = version .split ("." )
10+ return tuple (map (int ,parts ))
11+
12+
813def get_version_value_cargo ():
914with open ("Cargo.toml" ,encoding = "utf-8" )as f :
1015cargo_toml = toml .loads (f .read ())
11- return cargo_toml ["package" ]["version" ]
16+ return parse_version ( cargo_toml ["package" ]["version" ])
1217
1318
1419def get_version_value_changelog ():
@@ -25,7 +30,7 @@ def get_version_value_changelog():
2530line .strip (),
2631 )
2732if match is not None :
28- versions .append (match .group (1 ))
33+ versions .append (parse_version ( match .group (1 ) ))
2934assert versions == sorted (versions ,reverse = True )
3035return versions [0 ]
3136
@@ -37,14 +42,14 @@ def test_version_numbers_all_same():
3742 """
3843cargo_version = get_version_value_cargo ()
3944changelog_version = get_version_value_changelog ()
40- module_version = adblock .__version__
45+ module_version = parse_version ( adblock .__version__ )
4146
4247assert cargo_version == module_version
4348assert module_version == changelog_version
4449
4550
4651def get_current_python_version ():
47- return f" { sys .version_info .major } . { sys .version_info .minor } . { sys .version_info .micro } "
52+ return ( sys .version_info .major , sys .version_info .minor , sys .version_info .micro )
4853
4954
5055def test_required_python_version ():
@@ -58,4 +63,4 @@ def test_required_python_version():
5863required_python = cargo_toml ["package" ]["metadata" ]["maturin" ]["requires-python" ]
5964assert required_python .startswith (">=" )
6065required_python = required_python [2 :]
61- assert get_current_python_version ()>= required_python
66+ assert get_current_python_version ()>= parse_version ( required_python )