Skip to content

Commit c34b0a6

Browse files
committed
test: fix test failures
1 parent 3b299db commit c34b0a6

7 files changed

+34
-31
lines changed

tests/format/test_align_semantic_breaks_in_lists.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55
from markdown_it.utils import read_fixture_file
66

7-
from .helpers import print_text
7+
from ..helpers import print_text
88

99
FIXTURE_PATH = Path(__file__).parent / "fixtures/semantic_indent.md"
1010
fixtures = read_fixture_file(FIXTURE_PATH)

tests/format/test_ignore_missing_references.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import mdformat
22
import pytest
33

4-
from .helpers import print_text
4+
from ..helpers import print_text
55

66
TICKET_019 = """Example python mkdocstring snippets
77

tests/format/test_number.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import mdformat
22
import pytest
33

4-
from .helpers import print_text
4+
from ..helpers import print_text
55

66
CASE_1 = """
77
1. One
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import mdformat
2+
import pytest
3+
4+
from ..helpers import print_text
5+
6+
TABBED_CODE_BLOCK = '''
7+
1. Add a serializer class
8+
9+
```python
10+
class RecurringEventSerializer(serializers.ModelSerializer): # (1)!
11+
\t"""Used to retrieve recurring_event info"""
12+
13+
\tclass Meta:
14+
\t\tmodel = RecurringEvent # (2)!
15+
```
16+
'''
17+
18+
19+
@pytest.mark.parametrize(
20+
("text", "expected"),
21+
[
22+
(TABBED_CODE_BLOCK, TABBED_CODE_BLOCK),
23+
],
24+
ids=["TABBED_CODE_BLOCK"],
25+
)
26+
def test_tabbed_code_block(text: str, expected: str):
27+
output = mdformat.text(text, extensions={"mkdocs", "admonition"})
28+
print_text(output, expected)
29+
assert output.strip() == expected.strip()

tests/format/test_text.py

-26
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,3 @@ def test_text_fixtures(line, title, text, expected):
1919
output = mdformat.text(text, extensions={"mkdocs", "admonition"})
2020
print_text(output, expected)
2121
assert output.rstrip() == expected.rstrip()
22-
23-
24-
TABBED_CODE_BLOCK = '''
25-
1. Add a serializer class
26-
27-
```python
28-
class RecurringEventSerializer(serializers.ModelSerializer): # (1)!
29-
\t"""Used to retrieve recurring_event info"""
30-
31-
\tclass Meta:
32-
\t\tmodel = RecurringEvent # (2)!
33-
```
34-
'''
35-
36-
37-
@pytest.mark.parametrize(
38-
("text", "expected"),
39-
[
40-
(TABBED_CODE_BLOCK, TABBED_CODE_BLOCK),
41-
],
42-
ids=["TABBED_CODE_BLOCK"],
43-
)
44-
def test_tabbed_code_block(text: str, expected: str):
45-
output = mdformat.text(text, extensions={"mkdocs", "admonition"})
46-
print_text(output, expected)
47-
assert output.strip() == expected.strip()

tests/format/test_wrap.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import mdformat
22
import pytest
33

4-
from .helpers import print_text
4+
from ..helpers import print_text
55

66
# FYI: indented text that starts with a number is parsed as the start of a numbered list
77

tests/test_mdformat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def test_mdformat_text():
88
pth = Path(__file__).parent / "pre-commit-test.md"
99
content = pth.read_text()
1010

11-
result = mdformat.text(content, extensions={"mkdocs"})
11+
result = mdformat.text(content, extensions={"mkdocs", "gfm"})
1212

1313
pth.write_text(result) # Easier to debug with git
1414
assert result == content, "Differences found in format. Review in git."

0 commit comments

Comments
 (0)