Compare commits

..

3 Commits

View File

@ -230,6 +230,20 @@ This is an answer.
message = Message.from_file(self.file_path, tags_or={Tag('tag3')})
self.assertIsNone(message)
def test_from_file_txt_no_tags_dont_match(self) -> None:
message = Message.from_file(self.file_path_no_tags, tags_or={Tag('tag1')})
self.assertIsNone(message)
def test_from_file_txt_no_tags_match_tags_not(self) -> None:
message = Message.from_file(self.file_path_no_tags, tags_not={Tag('tag1')})
self.assertIsNotNone(message)
self.assertIsInstance(message, Message)
if message:
self.assertEqual(message.question, 'This is a question.')
self.assertEqual(message.answer, 'This is an answer.')
self.assertSetEqual(cast(set[Tag], message.tags), set())
self.assertEqual(message.file_path, self.file_path_no_tags)
def test_from_file_not_exists(self) -> None:
file_not_exists = pathlib.Path("example.txt")
with self.assertRaises(MessageError) as cm: