From 9d26d7746dffcd5002f16138b5aeffc0af32aceb Mon Sep 17 00:00:00 2001 From: Henrique Joaquim Date: Fri, 11 Nov 2022 18:42:00 +0000 Subject: [PATCH] Remove mockings (#3378) * removed mock break lines * removing debug print * keeping break line --- .../core/log/generation/formatter_with_exceptions.py | 12 +----------- .../log/generation/test_formatter_with_exceptions.py | 2 +- .../test_filter_log_line_2.txt | 2 +- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/openbb_terminal/core/log/generation/formatter_with_exceptions.py b/openbb_terminal/core/log/generation/formatter_with_exceptions.py index ae4d4cc55ad..6f1d4c8e365 100644 --- a/openbb_terminal/core/log/generation/formatter_with_exceptions.py +++ b/openbb_terminal/core/log/generation/formatter_with_exceptions.py @@ -67,19 +67,9 @@ class FormatterWithExceptions(logging.Formatter): return text_mocked - @staticmethod - def mock_break_lines(text: str) -> str: - text_mocked = text.replace("\n", " MOCKING_BREAKLINE ") - text_mocked = text_mocked.replace("\r", " MOCKING_CARRIAGE_RETURN ") - text_mocked = text_mocked.replace("\t", " MOCKING_TAB ") - text_mocked = text_mocked.replace("\\n", " MOCKING_BREAKLINE ") - text_mocked = text_mocked.replace("\\r", " MOCKING_CARRIAGE_RETURN ") - - return text_mocked - @classmethod def filter_special_tags(cls, text: str) -> str: - text_filtered = cls.mock_break_lines(text=text) + text_filtered = text.replace("\n", " MOCKING_BREAKLINE ") text_filtered = text_filtered.replace("'Traceback", "Traceback") return text_filtered diff --git a/tests/openbb_terminal/core/log/generation/test_formatter_with_exceptions.py b/tests/openbb_terminal/core/log/generation/test_formatter_with_exceptions.py index 5c42eb925cb..dbfddc5539a 100644 --- a/tests/openbb_terminal/core/log/generation/test_formatter_with_exceptions.py +++ b/tests/openbb_terminal/core/log/generation/test_formatter_with_exceptions.py @@ -46,7 +46,7 @@ def test_filter_log_line(recorder): text_expected = FormatterWithExceptions.filter_log_line(text=text) recorder.capture(text_expected) - text = "\\n\nhello \this\\r \rgreetings" + text = "\nhello this is greetings" text_expected = FormatterWithExceptions.filter_log_line(text=text) recorder.capture(text_expected) diff --git a/tests/openbb_terminal/core/log/generation/txt/test_formatter_with_exceptions/test_filter_log_line_2.txt b/tests/openbb_terminal/core/log/generation/txt/test_formatter_with_exceptions/test_filter_log_line_2.txt index 644a23d8728..e49179ae849 100644 --- a/tests/openbb_terminal/core/log/generation/txt/test_formatter_with_exceptions/test_filter_log_line_2.txt +++ b/tests/openbb_terminal/core/log/generation/txt/test_formatter_with_exceptions/test_filter_log_line_2.txt @@ -1 +1 @@ - MOCKING_BREAKLINE MOCKING_BREAKLINE hello MOCKING_TAB his MOCKING_CARRIAGE_RETURN MOCKING_CARRIAGE_RETURN greetings \ No newline at end of file + MOCKING_BREAKLINE hello this is greetings \ No newline at end of file