mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Change methods not using its bound instance to staticmethods
This commit is contained in:
parent
deab57c6dc
commit
25701aac4f
11 changed files with 40 additions and 20 deletions
|
|
@ -30,22 +30,26 @@ class Test_check_token:
|
|||
This case gonna be deleted
|
||||
"""
|
||||
|
||||
def test_ok(self, data):
|
||||
@staticmethod
|
||||
def test_ok(data):
|
||||
if check_token(data, TOKEN) is not True:
|
||||
raise AssertionError
|
||||
|
||||
def test_fail(self, data):
|
||||
@staticmethod
|
||||
def test_fail(data):
|
||||
data.pop("username")
|
||||
if check_token(data, TOKEN) is not False:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
class Test_check_integrity:
|
||||
def test_ok(self, data):
|
||||
@staticmethod
|
||||
def test_ok(data):
|
||||
if check_integrity(TOKEN, data) is not True:
|
||||
raise AssertionError
|
||||
|
||||
def test_fail(self, data):
|
||||
@staticmethod
|
||||
def test_fail(data):
|
||||
data.pop("username")
|
||||
if check_integrity(TOKEN, data) is not False:
|
||||
raise AssertionError
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ from aiogram.utils.helper import Item, ListItem, OrderedHelper
|
|||
|
||||
|
||||
class TestOrderedHelper:
|
||||
def test_items_are_ordered(self):
|
||||
@staticmethod
|
||||
def test_items_are_ordered():
|
||||
class Helper(OrderedHelper):
|
||||
A = Item()
|
||||
D = Item()
|
||||
|
|
@ -12,7 +13,8 @@ class TestOrderedHelper:
|
|||
if Helper.all() != ["A", "D", "C", "B"]:
|
||||
raise AssertionError
|
||||
|
||||
def test_list_items_are_ordered(self):
|
||||
@staticmethod
|
||||
def test_list_items_are_ordered():
|
||||
class Helper(OrderedHelper):
|
||||
A = ListItem()
|
||||
D = ListItem()
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ from aiogram.utils import markdown
|
|||
|
||||
|
||||
class TestMarkdownEscape:
|
||||
def test_equality_sign_is_escaped(self):
|
||||
@staticmethod
|
||||
def test_equality_sign_is_escaped():
|
||||
if markdown.escape_md(r"e = mc2") != r"e \= mc2":
|
||||
raise AssertionError
|
||||
|
||||
def test_pre_escaped(self):
|
||||
@staticmethod
|
||||
def test_pre_escaped():
|
||||
if markdown.escape_md(r"hello\.") != r"hello\\\.":
|
||||
raise AssertionError
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ from aiogram.utils import text_decorations
|
|||
|
||||
|
||||
class TestTextDecorations:
|
||||
def test_unparse_entities_normal_text(self):
|
||||
@staticmethod
|
||||
def test_unparse_entities_normal_text():
|
||||
if (
|
||||
text_decorations.markdown_decoration.unparse(
|
||||
"hi i'm bold and italic and still bold",
|
||||
|
|
@ -18,7 +19,8 @@ class TestTextDecorations:
|
|||
):
|
||||
raise AssertionError
|
||||
|
||||
def test_unparse_entities_emoji_text(self):
|
||||
@staticmethod
|
||||
def test_unparse_entities_emoji_text():
|
||||
"""
|
||||
emoji is encoded as two chars in json
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue