2023-12-19 14:32:28 +01:00
|
|
|
from dataclasses import dataclass
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
2024-01-18 17:15:16 +01:00
|
|
|
class ContentForTests:
|
2024-02-07 13:57:47 +01:00
|
|
|
input_: str | bytes
|
|
|
|
expected: str | bytes = ""
|
2023-12-19 14:32:28 +01:00
|
|
|
article_url: str = "kiwix.org"
|
|
|
|
|
|
|
|
def __post_init__(self):
|
|
|
|
if not self.expected:
|
2024-01-18 17:15:16 +01:00
|
|
|
self.expected = self.input_
|
2024-02-07 13:57:47 +01:00
|
|
|
|
|
|
|
@property
|
|
|
|
def input_str(self) -> str:
|
|
|
|
if isinstance(self.input_, str):
|
|
|
|
return self.input_
|
|
|
|
raise ValueError("Input value is not a str.")
|
|
|
|
|
|
|
|
@property
|
|
|
|
def input_bytes(self) -> bytes:
|
|
|
|
if isinstance(self.input_, bytes):
|
|
|
|
return self.input_
|
|
|
|
raise ValueError("Input value is not a bytes.")
|
|
|
|
|
|
|
|
@property
|
|
|
|
def expected_str(self) -> str:
|
|
|
|
if isinstance(self.expected, str):
|
|
|
|
return self.expected
|
|
|
|
raise ValueError("Expected value is not a str.")
|
|
|
|
|
|
|
|
@property
|
|
|
|
def expected_bytes(self) -> bytes:
|
|
|
|
if isinstance(self.expected, bytes):
|
|
|
|
return self.expected
|
|
|
|
raise ValueError("Expected value is not a bytes.")
|