1
- from pathlib import Path
1
+ """Test suite for bookmarks conversion."""
2
+
2
3
import pytest
3
- from mdtk .bookmarks import convert_bookmarks , BookmarkError
4
+
5
+ from mdtk .bookmarks import BookmarkError , convert_bookmarks
6
+
4
7
5
8
@pytest .fixture
6
9
def test_bookmarks_file (tmp_path ):
@@ -25,19 +28,21 @@ def test_bookmarks_file(tmp_path):
25
28
test_file .write_text (bookmarks_content )
26
29
return test_file
27
30
31
+
28
32
def test_basic_conversion (test_bookmarks_file , tmp_path ):
29
- """Test basic bookmark conversion with default folder"""
33
+ """Test basic bookmark conversion with default folder. """
30
34
test_md = tmp_path / "output.md"
31
35
32
36
convert_bookmarks (test_bookmarks_file , test_md )
33
37
34
- content = test_md .read_text ().strip ().split (' \n ' )
38
+ content = test_md .read_text ().strip ().split (" \n " )
35
39
assert len (content ) == 2
36
- assert '- [GitHub - Where the world builds software](https://github.com)' in content
37
- assert '- [Welcome to Python.org](https://python.org)' in content
40
+ assert "- [GitHub - Where the world builds software](https://github.com)" in content
41
+ assert "- [Welcome to Python.org](https://python.org)" in content
42
+
38
43
39
44
def test_nonexistent_folder (test_bookmarks_file , tmp_path ):
40
- """Test error handling for non-existent folder"""
45
+ """Test error handling for non-existent folder. """
41
46
test_md = tmp_path / "output.md"
42
47
43
48
with pytest .raises (BookmarkError , match = "Folder 'NonExistent' not found" ):
0 commit comments