From 8902515356aeeaee4730ba30f0744370b984fc1d Mon Sep 17 00:00:00 2001 From: Maximilien Rigaut Date: Thu, 2 Jun 2022 20:37:26 +0200 Subject: [PATCH] Ajusted tests --- src/bootstraparse/modules/context_mngr.py | 2 +- tests/modules/test_context_mngr.py | 1 - tests/modules/test_context_mngr_export.py | 2 ++ tests/modules/test_syntax.py | 6 +++--- tests/modules/test_syntax_context.py | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/bootstraparse/modules/context_mngr.py b/src/bootstraparse/modules/context_mngr.py index 2496553..5015fa6 100644 --- a/src/bootstraparse/modules/context_mngr.py +++ b/src/bootstraparse/modules/context_mngr.py @@ -519,7 +519,7 @@ class ContextManager: e.print_all() else: print("> " + str(e)) - print("Matched elements:" + self.matched_elements) + print("Matched elements:" + str(self.matched_elements)) # Defines all methods to manage the context of the parser as a file is being parsed diff --git a/tests/modules/test_context_mngr.py b/tests/modules/test_context_mngr.py index 3914cb1..ff6eee3 100644 --- a/tests/modules/test_context_mngr.py +++ b/tests/modules/test_context_mngr.py @@ -138,7 +138,6 @@ _token_list_with_expected_result = [ ]), ], __GLk(1), - __XF, ], [ [ diff --git a/tests/modules/test_context_mngr_export.py b/tests/modules/test_context_mngr_export.py index b6a91f5..b0ba18b 100644 --- a/tests/modules/test_context_mngr_export.py +++ b/tests/modules/test_context_mngr_export.py @@ -58,9 +58,11 @@ _list_classes_expected_value = [ ], [ context_mngr.EtCustomSpanContainer([ + sy.EtCustomSpanToken(["0"]), context_mngr.TextContainer([ sy.TextToken(['test6']), ]), + sy.EtCustomSpanToken(["0"]), ]), "test6", __GLk(1), diff --git a/tests/modules/test_syntax.py b/tests/modules/test_syntax.py index cd5b87c..dbc8d0d 100644 --- a/tests/modules/test_syntax.py +++ b/tests/modules/test_syntax.py @@ -616,7 +616,7 @@ list_add_tag_input_and_expected_output = [ (sy.StructuralElementEndToken(["div"]), ""), (sy.StructuralElementStartToken(["span"]), ""), (sy.StructuralElementEndToken(["span"]), ""), - (sy.EtCustomSpanToken(["(#12)"]), ""), + (sy.EtCustomSpanToken(["(#12)"]), ""), (sy.HeaderToken(["#", "Text"]), "
"), ] @@ -636,8 +636,8 @@ list_of_text_input_and_readable_output = [ "Text bold underline still bold "), # noqa E501 (line too long) ("[link]('http://www.google.com')", "il_link", ""), - ("Reverse order: (#123) Span, __underline__ ~~strikethrough~~ **emphasis * Strong**", "enhanced_text", - "Reverse order: Span, underline strikethrough emphasis Strong "), # noqa E501 (line too long) + ("Reverse order:(#123) Span, __underline__ ~~strikethrough~~ **emphasis * Strong**", "enhanced_text", + "Reverse order: Span, underline strikethrough emphasis Strong "), # noqa E501 (line too long) # Structural elements ("<"), diff --git a/tests/modules/test_syntax_context.py b/tests/modules/test_syntax_context.py index 46d8350..b3f3924 100644 --- a/tests/modules/test_syntax_context.py +++ b/tests/modules/test_syntax_context.py @@ -19,14 +19,14 @@ _type_counterpart_container = [ (syntax.EtStrongToken, 'text:strong', "token", tools.__GLk(1)), (syntax.EtUnderlineToken, 'text:underline', "token", tools.__GLk(1)), (syntax.EtStrikethroughToken, 'text:strikethrough', "token", tools.__GLk(1)), - (syntax.EtCustomSpanToken, None, "error", tools.__GLk(1)), + (syntax.EtCustomSpanToken, "text:custom_span:test", "token", tools.__GLk(1)), (syntax.EtUlistToken, None, "self", tools.__GLk(1)), (syntax.EtOlistToken, None, "self", tools.__GLk(1)), (syntax.HeaderToken, None, "self", tools.__GLk(1)), (syntax.DisplayToken, None, "self", tools.__GLk(1)), (syntax.StructuralElementStartToken, None, "error", tools.__GLk(1)), # A start can't be in a container (MismatchedContainerError) (syntax.StructuralElementEndToken, 'se:start:test', "error", tools.__GLk(1)), # An end can't be in a container (MismatchedContainerError) - (syntax.HyperlinkToken, None, "error", tools.__GLk(1)), # Shouldn't be an error + (syntax.HyperlinkToken, None, "self", tools.__GLk(1)), # Shouldn't be an error (syntax.TableToken, None, "error", tools.__GLk(1)), (syntax.TableRowToken, None, "error", tools.__GLk(1)), (syntax.TableCellToken, None, "error", tools.__GLk(1)),