Passed
Pull Request — main (#237)
by Yohann
01:49
created

tests.objects.message.test_user_messages   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A Message.__init__() 0 2 1
A TestUserMessages.test_clean_content() 0 6 1
1
# Copyright Pincer 2021-Present
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
# Full MIT License can be found in `LICENSE` at the project root.
3
from pincer.objects import UserMessage
4
5
6
class Message:
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
7
8
    def __init__(self, content):
9
        self.content = content
10
11
    clean_content = UserMessage.clean_content
12
13
14
class TestUserMessages:
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
15
16
    def test_clean_content(self):
0 ignored issues
show
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
introduced by
Missing function or method docstring
Loading history...
17
        assert Message('Hello, world!').clean_content == 'Hello, world!'
18
        assert Message('_*`Hello, world!`*_').clean_content == 'Hello, world!'
19
        assert Message('__~~Hello, world!~~__').clean_content == 'Hello, world!'
20
        assert Message('||Hello, world!||').clean_content == 'Hello, world!'
21
        assert Message('```py\nfoo\nbar\n```').clean_content == 'foo\nbar'
22