mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-03 04:10:49 +08:00
fixed code
This commit is contained in:
@ -415,6 +415,7 @@ class PRDescription:
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
</td>
|
||||
<td><a href="{link}">{diff_plus_minus}</a>{delta_nbsp}</td>
|
||||
</tr>
|
||||
@ -470,10 +471,6 @@ def insert_br_after_x_chars(text, x=70):
|
||||
is_saved_word = False
|
||||
if word == "<code>" or word == "</code>" or word == "<li>" or word == "<br>":
|
||||
is_saved_word = True
|
||||
if "<code>" in word:
|
||||
is_inside_code = True
|
||||
if "</code>" in word:
|
||||
is_inside_code = False
|
||||
|
||||
len_word = count_chars_without_html(word)
|
||||
if not is_saved_word and (current_length + len_word > x):
|
||||
@ -490,6 +487,10 @@ def insert_br_after_x_chars(text, x=70):
|
||||
if word == "<li>" or word == "<br>":
|
||||
current_length = 0
|
||||
|
||||
if "<code>" in word:
|
||||
is_inside_code = True
|
||||
if "</code>" in word:
|
||||
is_inside_code = False
|
||||
return ''.join(new_text).strip()
|
||||
|
||||
def replace_code_tags(text):
|
||||
|
@ -112,9 +112,17 @@ class TestBR:
|
||||
'ColorPaletteResourcesCollection ColorPaletteResourcesCollection`')
|
||||
file_change_description_br = insert_br_after_x_chars(file_change_description)
|
||||
expected_output = ('<li>Created a - new -class <code>ColorPaletteResourcesCollection </code><br><code>'
|
||||
'ColorPaletteResourcesCollection ColorPaletteResourcesCollection <br>'
|
||||
'ColorPaletteResourcesCollection</code>')
|
||||
'ColorPaletteResourcesCollection ColorPaletteResourcesCollection '
|
||||
'</code><br><code>ColorPaletteResourcesCollection</code>')
|
||||
assert file_change_description_br == expected_output
|
||||
# print("-----")
|
||||
# print(file_change_description_br)
|
||||
|
||||
def test_br3(self):
|
||||
file_change_description = 'Created a new class `ColorPaletteResourcesCollection` which extends `AvaloniaDictionary<ThemeVariant, ColorPaletteResources>` and implements aaa'
|
||||
file_change_description_br = insert_br_after_x_chars(file_change_description)
|
||||
assert file_change_description_br == ('Created a new class <code>ColorPaletteResourcesCollection</code> which '
|
||||
'extends <br><code>AvaloniaDictionary<ThemeVariant, ColorPaletteResources>'
|
||||
'</code> and implements <br>aaa')
|
||||
# print("-----")
|
||||
# print(file_change_description_br)
|
||||
|
Reference in New Issue
Block a user