summaryrefslogtreecommitdiffstats
path: root/tests/test_cli.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:23:02 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:23:02 +0000
commit943e3dc057eca53e68ddec51529bd6a1279ebd8e (patch)
tree61fb7bac619a56dfbcdcbdb7b0d4d6535fc36fe9 /tests/test_cli.py
parentInitial commit. (diff)
downloadmyst-parser-943e3dc057eca53e68ddec51529bd6a1279ebd8e.tar.xz
myst-parser-943e3dc057eca53e68ddec51529bd6a1279ebd8e.zip
Adding upstream version 0.18.1.upstream/0.18.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/test_cli.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_cli.py b/tests/test_cli.py
new file mode 100644
index 0000000..4725f93
--- /dev/null
+++ b/tests/test_cli.py
@@ -0,0 +1,15 @@
+from unittest import mock
+
+from myst_parser.cli import print_anchors
+
+
+def test_print_anchors():
+ from io import StringIO
+
+ in_stream = StringIO("# a\n\n## b\n\ntext")
+ out_stream = StringIO()
+ with mock.patch("sys.stdin", in_stream):
+ with mock.patch("sys.stdout", out_stream):
+ print_anchors(["-l", "1"])
+ out_stream.seek(0)
+ assert out_stream.read().strip() == '<h1 id="a"></h1>'