Change methods not using its bound instance to staticmethods

This commit is contained in:
deepsource-autofix[bot] 2020-11-08 21:54:06 +00:00 committed by GitHub
parent deab57c6dc
commit 25701aac4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 40 additions and 20 deletions

View file

@ -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

View file

@ -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()

View file

@ -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

View file

@ -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
"""