aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorhalcy <halcy@ARARAGI-KUN>2022-11-24 01:37:47 +0200
committerhalcy <halcy@ARARAGI-KUN>2022-11-24 01:37:47 +0200
commit3caa27a113945bc1662f4f63fa0387b9aece6390 (patch)
tree714364c68062192a26a55d5db999e3e5ee81c95d /tests
parentb7266db01b73348bb74dd4277053825580193477 (diff)
downloadmastodon.py-3caa27a113945bc1662f4f63fa0387b9aece6390.tar.gz
Robustify version parsing
Diffstat (limited to 'tests')
-rw-r--r--tests/test_instance.py13
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 @@
1import pytest 1import pytest
2 2
3from mastodon.Mastodon import MastodonVersionError 3from mastodon.Mastodon import MastodonVersionError
4from mastodon.Mastodon import parse_version_string
4import datetime 5import datetime
5import os 6import os
6import pickle 7import pickle
@@ -75,3 +76,15 @@ def test_directory(api):
75@pytest.mark.vcr() 76@pytest.mark.vcr()
76def test_instance_rules(api): 77def test_instance_rules(api):
77 assert isinstance(api.instance_rules(), list) 78 assert isinstance(api.instance_rules(), list)
79
80def 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]
Powered by cgit v1.2.3 (git 2.41.0)