Compare commits
3 Commits
1569b717f8
...
af65811a97
| Author | SHA1 | Date | |
|---|---|---|---|
| af65811a97 | |||
| 6a81b9b146 | |||
| 85375346f4 |
@ -230,6 +230,20 @@ This is an answer.
|
|||||||
message = Message.from_file(self.file_path, tags_or={Tag('tag3')})
|
message = Message.from_file(self.file_path, tags_or={Tag('tag3')})
|
||||||
self.assertIsNone(message)
|
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:
|
def test_from_file_not_exists(self) -> None:
|
||||||
file_not_exists = pathlib.Path("example.txt")
|
file_not_exists = pathlib.Path("example.txt")
|
||||||
with self.assertRaises(MessageError) as cm:
|
with self.assertRaises(MessageError) as cm:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user