Skip to content

Commit

Permalink
新增json单行富文本转化测试用例
Browse files Browse the repository at this point in the history
  • Loading branch information
BinghamChi committed Jul 2, 2024
1 parent 6522b14 commit f631b0d
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/test-convert.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"2": "1",
"3": "Ju9C-1621846617594",
"4": {
"version": 1,
"incompatibleVersion": 0,
"fv": "0"
},
"5": [
{
"3": "FbBV-1718363156752",
"5": [
{
"2": "2",
"3": "vozk-1718363156751",
"7": [
{
"8": "测试单行富文本丢失问题从"
},
{
"8": "这里开始",
"9": [
{
"2": "b"
}
]
},
{
"8": "之后的内容就没了"
}
]
}
]
}
],
"__compress__": true,
"title": ""
}
1 change: 1 addition & 0 deletions test/test-convert.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
测试单行富文本丢失问题从**这里开始**之后的内容就没了
11 changes: 11 additions & 0 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,17 @@ def test_covert_json_to_markdown_content(self):
# CRLF => \r\n, LF => \n
self.assertEqual(content.replace("\r\n", "\n"), content_target)

def test_covert_json_to_markdown_single_line(self):
"""
测试 json 转换 markdown 单行富文本
python test.py YoudaoNoteCovert.test_covert_json_to_markdown_single_line
"""
line = YoudaoNoteConvert._covert_json_to_markdown_content("test/test-convert.json")
with open("test/test-convert.md", "rb") as f:
target = f.read().decode()
# CRLF => \r\n, LF => \n
self.assertEqual(line.replace("\r\n", "\n"), target)


class YoudaoNotePullTest(unittest.TestCase):
TEST_CONFIG_PATH = "test_config.json"
Expand Down

0 comments on commit f631b0d

Please sign in to comment.