insert_br_after_x_chars

This commit is contained in:
mrT23
2024-02-05 09:20:36 +02:00
parent e104bd7a3f
commit 2ee329674f
17 changed files with 200 additions and 152 deletions

View File

@ -3,7 +3,7 @@ from unittest.mock import patch
from pr_agent.git_providers.codecommit_provider import CodeCommitFile
from pr_agent.git_providers.codecommit_provider import CodeCommitProvider
from pr_agent.git_providers.codecommit_provider import PullRequestCCMimic
from pr_agent.git_providers.git_provider import EDIT_TYPE
from pr_agent.algo.types import EDIT_TYPE, FilePatchInfo
class TestCodeCommitFile:

View File

@ -1,5 +1,6 @@
# Generated by CodiumAI
from pr_agent.algo.utils import convert_to_markdown
from pr_agent.tools.pr_description import insert_br_after_x_chars
"""
Code Analysis
@ -93,3 +94,28 @@ class TestConvertToMarkdown:
}
expected_output = ''
assert convert_to_markdown(input_data).strip() == expected_output.strip()
class TestBR:
def test_br1(self):
file_change_description = '- Created a new class `ColorPaletteResourcesCollection` in the namespace `Avalonia.Themes.Fluent`.\n- The class extends `AvaloniaDictionary<ThemeVariant, ColorPaletteResources>` and implements `IResourceProvider`.\n- The class includes methods for handling theme variants, resource retrieval, owner management, and property change events.'
file_change_description_br = insert_br_after_x_chars(file_change_description)
expected_output=('<li>Created a new class <code>ColorPaletteResourcesCollection</code> <br>in the namespace '
'<code>Avalonia.Themes.Fluent</code>.<br> <li> The class extends <code>AvaloniaDictionary'
'<ThemeVariant, <br>ColorPaletteResources></code> and implements <br><code>IResourceProvider'
'</code>.<br> <li> The class includes methods for handling theme variants, resource <br>'
'retrieval, owner management, and property change events.')
assert file_change_description_br == expected_output
# print("-----")
# print(file_change_description_br)
def test_br2(self):
file_change_description = ('- Created a - new -class `ColorPaletteResourcesCollection ColorPaletteResourcesCollection '
'ColorPaletteResourcesCollection ColorPaletteResourcesCollection`')
file_change_description_br = insert_br_after_x_chars(file_change_description)
expected_output = ('<li>Created a - new -class <code>ColorPaletteResourcesCollection '
'<br>ColorPaletteResourcesCollection ColorPaletteResourcesCollection '
'<br>ColorPaletteResourcesCollection</code>')
assert file_change_description_br == expected_output
# print("-----")
# print(file_change_description_br)

View File

@ -1,8 +1,7 @@
# Generated by CodiumAI
from pr_agent.git_providers.git_provider import FilePatchInfo
from pr_agent.algo.pr_processing import find_line_number_of_relevant_line_in_file
from pr_agent.git_providers.types import FilePatchInfo
from pr_agent.algo.utils import find_line_number_of_relevant_line_in_file
import pytest