diff options
author | halcy <halcy@ARARAGI-KUN> | 2022-11-24 01:37:47 +0200 |
---|---|---|
committer | halcy <halcy@ARARAGI-KUN> | 2022-11-24 01:37:47 +0200 |
commit | 3caa27a113945bc1662f4f63fa0387b9aece6390 (patch) | |
tree | 714364c68062192a26a55d5db999e3e5ee81c95d /tests | |
parent | b7266db01b73348bb74dd4277053825580193477 (diff) | |
download | mastodon.py-3caa27a113945bc1662f4f63fa0387b9aece6390.tar.gz |
Robustify version parsing
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_instance.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_instance.py b/tests/test_instance.py index 1fbd692..e25a686 100644 --- a/tests/test_instance.py +++ b/tests/test_instance.py | |||
@@ -1,6 +1,7 @@ | |||
1 | import pytest | 1 | import pytest |
2 | 2 | ||
3 | from mastodon.Mastodon import MastodonVersionError | 3 | from mastodon.Mastodon import MastodonVersionError |
4 | from mastodon.Mastodon import parse_version_string | ||
4 | import datetime | 5 | import datetime |
5 | import os | 6 | import os |
6 | import pickle | 7 | import pickle |
@@ -75,3 +76,15 @@ def test_directory(api): | |||
75 | @pytest.mark.vcr() | 76 | @pytest.mark.vcr() |
76 | def test_instance_rules(api): | 77 | def test_instance_rules(api): |
77 | assert isinstance(api.instance_rules(), list) | 78 | assert isinstance(api.instance_rules(), list) |
79 | |||
80 | def test_version_parsing(api): | ||
81 | assert parse_version_string(api._Mastodon__normalize_version_string("4.0.2")) == [4, 0, 2] | ||
82 | assert parse_version_string(api._Mastodon__normalize_version_string("2.1.0rc3")) == [2, 1, 0] | ||
83 | assert parse_version_string(api._Mastodon__normalize_version_string("1.0.7+3.5.5")) == [3, 5, 5] | ||
84 | assert parse_version_string(api._Mastodon__normalize_version_string("1.0.7+3.5.5rc2")) == [3, 5, 5] | ||
85 | assert parse_version_string(api._Mastodon__normalize_version_string("3.5.1+chitter")) == [3, 5, 1] | ||
86 | assert parse_version_string(api._Mastodon__normalize_version_string("3.5.1+chitter-6.6.6")) == [3, 5, 1] | ||
87 | assert parse_version_string(api._Mastodon__normalize_version_string("3.5.1rc4+chitter-6.6.6")) == [3, 5, 1] | ||
88 | assert parse_version_string(api._Mastodon__normalize_version_string("3.5.1+chitter6.6.6")) == [3, 5, 1] | ||
89 | assert parse_version_string(api._Mastodon__normalize_version_string("3.5.0 (compatible; Pleroma 1.2.3)")) == [3, 5, 0] | ||
90 | assert parse_version_string(api._Mastodon__normalize_version_string("3.2.1rc3 (compatible; Akkoma 3.2.4+shinychariot)")) == [3, 2, 1] | ||