diff --git a/openbb_sdk/sdk/core/openbb_core/app/logs/formatters/formatter_with_exceptions.py b/openbb_sdk/sdk/core/openbb_core/app/logs/formatters/formatter_with_exceptions.py index 17ccd72ff64..9c424a798f2 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/logs/formatters/formatter_with_exceptions.py +++ b/openbb_sdk/sdk/core/openbb_core/app/logs/formatters/formatter_with_exceptions.py @@ -76,7 +76,7 @@ class FormatterWithExceptions(logging.Formatter): @staticmethod def mock_home_directory(text: str) -> str: user_home_directory = str(Path.home().as_posix()) - text_mocked = text.replace("\\", "/").replace( + text_mocked = text.replace("\\\\", "/").replace( user_home_directory, "MOCKING_USER_PATH" ) diff --git a/openbb_sdk/sdk/core/tests/app/logs/formatters/test_formatter_with_exceptions.py b/openbb_sdk/sdk/core/tests/app/logs/formatters/test_formatter_with_exceptions.py index 662187bfdb4..f2e7e6008ca 100644 --- a/openbb_sdk/sdk/core/tests/app/logs/formatters/test_formatter_with_exceptions.py +++ b/openbb_sdk/sdk/core/tests/app/logs/formatters/test_formatter_with_exceptions.py @@ -198,12 +198,12 @@ def test_mock_flair(input_text, expected_output, formatter): [ ( "This is C:\\Users\\username\\file.txt", - "This is C:/Users/username/file.txt", + "This is C:\\Users\\username\\file.txt", ), ("No home directory here!", "No home directory here!"), ( f"This is {os.path.expanduser('~')}\\file.txt", - "This is MOCKING_USER_PATH/file.txt", + "This is MOCKING_USER_PATH\\file.txt", ), ( f"Some path: {os.path.expanduser('~/subfolder')}", @@ -240,7 +240,7 @@ def test_filter_special_tags(input_text, expected_output, formatter): [ ( f"This is {os.path.expanduser('~')}\\file.txt", - "This is MOCKING_USER_PATH/file.txt", + "This is MOCKING_USER_PATH\\file.txt", ), ('{"FLAIR": "[announcement]"}', '{"FLAIR": "[ FILTERED_FLAIR ]"}'), ("Another email: alice@example.co.uk", "Another email: FILTERED_EMAIL "), @@ -257,7 +257,7 @@ def test_filter_piis(input_text, expected_output, formatter): [ ( f"This is {os.path.expanduser('~')}\\file.txt", - "This is MOCKING_USER_PATH/file.txt", + "This is MOCKING_USER_PATH\\file.txt", ), ('{"FLAIR": "[announcement]"}', '{"FLAIR": "[ FILTERED_FLAIR ]"}'), ("Another email: alice@example.co.uk", "Another email: FILTERED_EMAIL "),