quiz_element.QuizElement.__init__()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 11
rs 9.95
c 0
b 0
f 0
cc 2
nop 3
1
from .illustrations.illustration import Illustration  # type: ignore
2
3
4
class QuizElement:
5
    def __init__(
6
        self,
7
        text: str,
8
        illustration: Illustration | None = None,
9
    ) -> None:
10
        assert isinstance(text, str)
11
        self.text = text
12
13
        if illustration:
14
            assert isinstance(illustration, Illustration)
15
        self.illustration = illustration
16
17
    def __str__(self) -> str:
18
        text = self.text
19
        if self.illustration:
20
            text += str(self.illustration)
21
        return text
22