Passed
Push — main ( 853695...d18ab9 )
by Máté
03:41 queued 02:14
created

quiz_element   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 17
dl 0
loc 23
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A QuizElement.__init__() 0 11 2
A QuizElement.__str__() 0 5 2
1
# noinspection PyPackages
2
from .illustrations.illustration import Illustration  # type: ignore
3
4
5
class QuizElement:
6
    def __init__(
7
        self,
8
        text: str,
9
        illustration: Illustration | None = None,
10
    ) -> None:
11
        assert isinstance(text, str)
12
        self.text = text
13
14
        if illustration:
15
            assert isinstance(illustration, Illustration)
16
        self.illustration = illustration
17
18
    def __str__(self) -> str:
19
        text = self.text
20
        if self.illustration:
21
            text += str(self.illustration)
22
        return text
23