Compare commits
10 Commits
59782f54ca
...
25fffb6fea
| Author | SHA1 | Date | |
|---|---|---|---|
| 25fffb6fea | |||
| cf572e1882 | |||
| 2fb7410b43 | |||
| 33ae27f00e | |||
| f6a6e6036b | |||
| 525cdb92a1 | |||
| fc82f85b7c | |||
| d90845b58b | |||
| 98777295d6 | |||
| f6109949c8 |
@ -393,9 +393,9 @@ class Message():
|
||||
try:
|
||||
data = yaml.load(fd, Loader=yaml.FullLoader)
|
||||
data[cls.file_yaml_key] = file_path
|
||||
return cls.from_dict(data)
|
||||
except Exception:
|
||||
raise MessageError(f"'{file_path}' does not contain a valid message")
|
||||
return cls.from_dict(data)
|
||||
|
||||
def to_str(self, with_tags: bool = False, with_file: bool = False, source_code_only: bool = False) -> str:
|
||||
"""
|
||||
|
||||
@ -2,6 +2,7 @@ import unittest
|
||||
import pathlib
|
||||
import tempfile
|
||||
import time
|
||||
import yaml
|
||||
from io import StringIO
|
||||
from unittest.mock import patch
|
||||
from chatmastermind.tags import TagLine
|
||||
@ -184,6 +185,10 @@ class TestChatDB(unittest.TestCase):
|
||||
for file in self.trash_files:
|
||||
with open(pathlib.Path(self.db_path.name) / file, 'w') as f:
|
||||
f.write('test trash')
|
||||
# also create a file with actual yaml content
|
||||
with open(pathlib.Path(self.db_path.name) / 'content.yaml', 'w') as f:
|
||||
yaml.dump({'key': 'value'}, f)
|
||||
self.trash_files.append('content.yaml')
|
||||
self.maxDiff = None
|
||||
|
||||
def message_list(self, tmp_dir: tempfile.TemporaryDirectory) -> list[pathlib.Path]:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user