Changed the tests accordingly

This commit is contained in:
Maximilien Rigaut 2022-06-13 21:13:28 +02:00
parent 3e92f661f4
commit 8358070ff2
No known key found for this signature in database
GPG Key ID: 4F14B23709ADA5B1
4 changed files with 19 additions and 19 deletions

View File

@ -78,7 +78,7 @@ def __module_path(module_name):
# Frame inspection
########################################
# Cursed frame inspection
def __prev_stack(nb=0): # pragma: no cover (Cursed frame inspection)
def __prev_stack(nb=1): # pragma: no cover (Cursed frame inspection)
"""
Return the nth previous stack
:return: Previous stack

View File

@ -315,6 +315,7 @@ _token_list_with_expected_result = [
[
[
sy.TableRowToken([
sy.TableCellSizeToken(["2"]),
sy.TableCellToken([
sy.TextToken(["a"]),
]),
@ -327,7 +328,7 @@ _token_list_with_expected_result = [
context_mngr.TableRowContainer([
context_mngr.TableCellContainer([
context_mngr.TextContainer([sy.TextToken(["a"])]),
]),
], others={"colspan": "2"}),
context_mngr.TableCellContainer([
context_mngr.TextContainer([sy.TextToken(["b"])]),
]),
@ -339,11 +340,11 @@ _token_list_with_expected_result = [
[
[
sy.TableRowToken([
"2",
sy.TableCellSizeToken(["2"]),
sy.TableCellToken([
sy.TextToken(["a"]),
]),
"3",
sy.TableCellSizeToken(["3"]),
sy.TableCellToken([
sy.TextToken(["b"]),
]),
@ -367,12 +368,9 @@ _token_list_with_expected_result = [
sy.TableSeparatorToken(["---", "---"]),
],
[
context_mngr.TableSeparatorContainer([
sy.TableSeparatorToken(["---", "---"]),
]),
error_mngr.MismatchedContainerError,
],
__GLk(1),
__XF,
],
[
[

View File

@ -458,32 +458,32 @@ dict_advanced_syntax_input_and_expected_output = {
), __GLk()),
("|2 Text1 | Text2 |", (
sy.TableRowToken([
'2',
sy.TableCellSizeToken(['2']),
sy.TableCellToken([sy.TextToken(["Text1 "])]),
sy.TableCellToken([sy.TextToken(["Text2 "])]),
]),
), __GLk()),
("|2 Text1 |3 Text2 |", (
sy.TableRowToken([
'2',
sy.TableCellSizeToken(['2']),
sy.TableCellToken([sy.TextToken(["Text1 "])]),
'3',
sy.TableCellSizeToken(['3']),
sy.TableCellToken([sy.TextToken(["Text2 "])]),
]),
), __GLk()),
("|2 Text1 |3 Text2 |4 Text3 |", (
sy.TableRowToken([
'2',
sy.TableCellSizeToken(['2']),
sy.TableCellToken([sy.TextToken(["Text1 "])]),
'3',
sy.TableCellSizeToken(['3']),
sy.TableCellToken([sy.TextToken(["Text2 "])]),
'4',
sy.TableCellSizeToken(['4']),
sy.TableCellToken([sy.TextToken(["Text3 "])]),
]),
), __GLk()),
("|3 Text1 | Text2 | {var='test', number=11}", (
sy.TableRowToken([
'3',
sy.TableCellSizeToken(['3']),
sy.TableCellToken([sy.TextToken(["Text1 "])]),
sy.TableCellToken([sy.TextToken(["Text2 "])]),
]),
@ -517,7 +517,7 @@ dict_advanced_syntax_input_and_expected_output = {
), __GLk(),),
("|2 Text1 | Text2 |", (
sy.TableRowToken([
"2",
sy.TableCellSizeToken(['2']),
sy.TableCellToken([sy.TextToken(["Text1 "])]),
sy.TableCellToken([sy.TextToken(["Text2 "])]),
]),
@ -662,7 +662,8 @@ list_of_text_input_and_readable_output = [
# Tables
("| Text1 | Text2 |", "table", "<table:row = '<table:cell = 'Text1 ' />,<table:cell = 'Text2 ' />' />"),
("| Text1 |3 Text2 |", "table", "<table:row = '<table:cell = 'Text1 ' />,3,<table:cell = 'Text2 ' />' />"),
("| Text1 |3 Text2 |", "table", "<table:row = '<table:cell = 'Text1 ' />,<table:cell_size = '3' "
"/>,<table:cell = 'Text2 ' />' />"),
("|---|---|", "table_separator", "<table:separator = '---,---' />"),
("|:--|-:-|--:|--:|", "table_separator", "<table:separator = ':--,-:-,--:,--:' />"),

View File

@ -27,7 +27,7 @@ _type_counterpart_container = [
(syntax.StructuralElementEndToken, 'se:start:test', "error", tools.__GLk(1)), # An end can't be in a container (MismatchedContainerError) # noqa
(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.TableRowToken, None, "self", tools.__GLk(1)),
(syntax.TableCellToken, None, "error", tools.__GLk(1)),
(syntax.TableSeparatorToken, None, "error", tools.__GLk(1)),
(syntax.BlockQuoteToken, None, "error", tools.__GLk(1)),
@ -58,4 +58,5 @@ def test_counterpart_container(type_n, expected_counterpart, expected_container,
else:
raise ValueError("Invalid expected_container value: {}".format(expected_container))
except Exception as e:
assert False, "Unexpected exception: {} in \n{}".format(e, file_n)
print("Unexpected exception: {} in \n{}".format(e, file_n))
raise e