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

Message.__init__()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
nop 2
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