You've already forked HeurAMS-legacy
fix
This commit is contained in:
@@ -38,8 +38,8 @@ class TestMCQPuzzle(unittest.TestCase):
|
||||
self.assertEqual(len(puzzle.jammer), 4)
|
||||
self.assertEqual(set(puzzle.jammer), {" "}) # 三个空格?实际上循环填充空格
|
||||
|
||||
@patch('random.sample')
|
||||
@patch('random.shuffle')
|
||||
@patch("random.sample")
|
||||
@patch("random.shuffle")
|
||||
def test_refresh(self, mock_shuffle, mock_sample):
|
||||
"""测试 refresh 方法生成题目"""
|
||||
mapping = {"q1": "a1", "q2": "a2", "q3": "a3"}
|
||||
@@ -51,7 +51,7 @@ class TestMCQPuzzle(unittest.TestCase):
|
||||
["j1", "j2", "j3"], # 为每个问题选择干扰项(实际调用两次)
|
||||
]
|
||||
puzzle.refresh()
|
||||
|
||||
|
||||
# 检查 wording 是列表
|
||||
self.assertIsInstance(puzzle.wording, list)
|
||||
self.assertEqual(len(puzzle.wording), 2)
|
||||
@@ -110,7 +110,7 @@ class TestMCQPuzzle(unittest.TestCase):
|
||||
puzzle.answer = ["选择题 - 尚未刷新谜题"]
|
||||
self.assertIn("选择题 - 尚未刷新谜题", str(puzzle))
|
||||
self.assertIn("正确答案", str(puzzle))
|
||||
|
||||
|
||||
puzzle.wording = ["Q1", "Q2"]
|
||||
puzzle.answer = ["A1", "A2"]
|
||||
str_repr = str(puzzle)
|
||||
@@ -118,5 +118,5 @@ class TestMCQPuzzle(unittest.TestCase):
|
||||
self.assertIn("A1, A2", str_repr)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user