| 130 | |
| 131 | |
| 132 | class FormatCommentFallbackTest(unittest.TestCase): |
| 133 | def test_plain_content(self): |
| 134 | md = pr.format_comment_fallback({"content": "hello", "path": "a.py"}) |
| 135 | self.assertIn("### 📄 `a.py`", md) |
| 136 | self.assertIn("hello", md) |
| 137 | |
| 138 | def test_with_line_range(self): |
| 139 | md = pr.format_comment_fallback({ |
| 140 | "content": "issue", |
| 141 | "path": "a.py", |
| 142 | "start_line": 3, |
| 143 | "end_line": 7, |
| 144 | }) |
| 145 | self.assertIn("(L3-L7)", md) |
| 146 | |
| 147 | def test_with_suggestion(self): |
| 148 | md = pr.format_comment_fallback(comment( |
| 149 | content="fix this", |
| 150 | existing_code="x = 1", |
| 151 | suggestion_code="x = 2", |
| 152 | )) |
| 153 | self.assertIn("<details><summary>💡 Suggested Change</summary>", md) |
| 154 | self.assertIn("**Before:**\n```\nx = 1\n```", md) |
| 155 | self.assertIn("**After:**\n```\nx = 2\n```", md) |
| 156 | self.assertIn("</details>", md) |
| 157 | |
| 158 | def test_suggestion_without_existing(self): |
| 159 | md = pr.format_comment_fallback(comment( |
| 160 | content="fix this", |
| 161 | suggestion_code="x = 2", |
| 162 | )) |
| 163 | self.assertNotIn("<details>", md) |
| 164 | |
| 165 | |
| 166 | # --------------------------------------------------------------------------- # |
nothing calls this directly
no outgoing calls
no test coverage detected