generated from executablebooks/mdformat-plugin
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
31 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"""Auto-loaded plugin for mdformat.""" | ||
"""Public Extension.""" | ||
|
||
from __future__ import annotations | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,36 @@ | ||
from __future__ import annotations | ||
|
||
from itertools import chain | ||
from pathlib import Path | ||
from typing import TypeVar | ||
|
||
import mdformat | ||
import pytest | ||
from markdown_it.utils import read_fixture_file | ||
|
||
from tests.helpers import print_text | ||
|
||
FIXTURE_PATH = Path(__file__).parent / "fixtures/text.md" | ||
fixtures = read_fixture_file(FIXTURE_PATH) | ||
T = TypeVar("T") | ||
|
||
|
||
def flatten(nested_list: list[list[T]]) -> list[T]: | ||
return [*chain(*nested_list)] | ||
|
||
|
||
fixtures = flatten( | ||
[ | ||
read_fixture_file(Path(__file__).parent / "fixtures" / fixture_path) | ||
for fixture_path in ("text.md",) | ||
], | ||
) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("line", "title", "text", "expected"), | ||
fixtures, | ||
ids=[f[1] for f in fixtures], | ||
) | ||
def test_text_fixtures(line, title, text, expected): | ||
def test_format_fixtures(line, title, text, expected): | ||
output = mdformat.text(text, extensions={"admon"}) | ||
print_text(output, expected) | ||
assert output.rstrip() == expected.rstrip() |
This file was deleted.
Oops, something went wrong.