From 2a527e00c6cd4bd19f0c4ec726a3c8beb173231b Mon Sep 17 00:00:00 2001 From: Noa Levi <275430404+lphuc2250gma@users.noreply.github.com> Date: Sat, 6 Jun 2026 04:17:21 +0000 Subject: [PATCH] chore: improve pdf-craft maintenance path --- tests/test_jointer.py | 7 +++++++ tests/test_parser.py | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/tests/test_jointer.py b/tests/test_jointer.py index b6f47ad..b05f17e 100644 --- a/tests/test_jointer.py +++ b/tests/test_jointer.py @@ -450,6 +450,13 @@ def test_multiple_formulas(self): def test_empty_string(self): """测试空字符串""" result = _parse_block_content("") + self.assertIsInstance(result, list) + self.assertEqual(len(result), 0) + + def test_none_input(self): + """测试 None 输入""" + result = _parse_block_content(None) + self.assertIsInstance(result, list) self.assertEqual(len(result), 0) def test_formula_only(self): diff --git a/tests/test_parser.py b/tests/test_parser.py index 2c7774f..43ad6c9 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -424,6 +424,23 @@ def test_nested_same_tags(self): self.assertEqual(inner_div.definition.name, "div") self.assertEqual(inner_div.children, ["Inner"]) + def test_empty_input(self): + """测试空字符串输入""" + result = parse_raw_markdown("") + self.assertIsInstance(result, list) + self.assertEqual(len(result), 0) + + def test_single_quoted_attributes(self): + """测试单引号属性值""" + result = parse_raw_markdown("
Content
") + self.assertEqual(len(result), 1) + tag = result[0] + self.assertIsInstance(tag, HTMLTag) + assert isinstance(tag, HTMLTag) + attr_dict = dict(tag.attributes) + self.assertEqual(attr_dict["id"], "test") + self.assertEqual(attr_dict["title"], "Test Div") + if __name__ == "__main__": unittest.main()