mirror of
https://github.com/dtomlinson91/tembo.git
synced 2025-12-22 07:45:44 +00:00
adding latest
This commit is contained in:
@@ -272,6 +272,37 @@ def test_create_tokened_page_input_tokens_preserve_order(datadir, caplog):
|
||||
assert scoped_page_contents.readline() == "third_input second_input"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"user_input,expected,given",
|
||||
[
|
||||
(None, 3, 0),
|
||||
(("first_input", "second_input"), 3, 2),
|
||||
(("first_input", "second_input", "third_input", "fourth_input"), 3, 4),
|
||||
],
|
||||
)
|
||||
def test_create_page_mismatched_tokens(tmpdir, user_input, expected, given):
|
||||
# arrange
|
||||
options = PageCreatorOptions(
|
||||
base_path=str(tmpdir),
|
||||
page_path="some_path",
|
||||
filename="input_token_{input0}_{input1}_{input2}",
|
||||
extension="md",
|
||||
name="some_name",
|
||||
user_input=user_input,
|
||||
example=None,
|
||||
template_filename=None,
|
||||
template_path=None,
|
||||
)
|
||||
|
||||
# act
|
||||
with pytest.raises(exceptions.MismatchedTokenError) as mismatched_token_error:
|
||||
scoped_page = ScopedPageCreator(options).create_page()
|
||||
|
||||
# assert
|
||||
assert mismatched_token_error.value.expected == expected
|
||||
assert mismatched_token_error.value.given == given
|
||||
|
||||
|
||||
def test_create_page_spaces_in_path(tmpdir, caplog):
|
||||
# arrange
|
||||
options = PageCreatorOptions(
|
||||
|
||||
Reference in New Issue
Block a user