Skip to content

Commit 69b98dc

Browse files
authored
Tied Up 2.4 Loose Ends (#181)
* Added docs for each enum * Added missing tests * Updated the coverage report
1 parent ffa714a commit 69b98dc

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
run: poetry run coverage run -m pytest
3636

3737
- name: Coverage
38-
run: poetry run coverage report
38+
run: poetry run coverage report -m
3939

4040
- name: PyLint
4141
run: poetry run pylint snakemd

snakemd/templates.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,41 @@ class Kind(Enum):
8282
kinds of alerts that you might place in a
8383
document.
8484
"""
85+
8586
NOTE = auto()
87+
"""
88+
As the GitHub docs state, a note should provide
89+
"useful information that users should know,
90+
even when skimming content."
91+
"""
92+
8693
TIP = auto()
94+
"""
95+
As the GitHub docs state, a tip should provide
96+
"helpful advice for doing things better or
97+
more easily."
98+
"""
99+
87100
IMPORTANT = auto()
101+
"""
102+
As the GitHub docs state, an important alert should
103+
provide "key information users need to know to
104+
achieve their goal."
105+
"""
106+
88107
WARNING = auto()
108+
"""
109+
As the GitHub docs state, a warning should provide
110+
"urgent info that needs immediate user attention
111+
to avoid problems."
112+
"""
113+
89114
CAUTION = auto()
115+
"""
116+
As the GitHub docs state, a caution alert should
117+
"[advise] about risks or negative outcomes of
118+
certain actions."
119+
"""
90120

91121
def __init__(
92122
self,

tests/document/test_document.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22

3-
from snakemd import Document, Heading, HorizontalRule, Paragraph
3+
from snakemd import Document, Heading, HorizontalRule, Paragraph, Alert
44

55
# Method tests (singles)
66

@@ -146,6 +146,12 @@ def test_add_block_horizontal_rule():
146146
assert str(doc) == "***"
147147

148148

149+
def test_add_alert():
150+
doc = Document()
151+
doc.add_alert("Do not the cat", Alert.Kind.CAUTION)
152+
assert str(doc) == "> [!CAUTION]\n> Do not the cat"
153+
154+
149155
def test_scramble_empty():
150156
doc = Document()
151157
doc.scramble()

0 commit comments

Comments
 (0)