Skip to content

Commit e6f8466

Browse files
committed
Add worflows - tests
1 parent 3044bcc commit e6f8466

File tree

1 file changed

+34
-22
lines changed

1 file changed

+34
-22
lines changed
Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
import os
22
import unittest
33

4-
from koreader_highlights_2_anki.__main__ import parse_lua_highlights_annotations, parse_lua_highlights_bookmarks
4+
from koreader_highlights_2_anki.__main__ import (
5+
parse_lua_highlights_annotations,
6+
parse_lua_highlights_bookmarks,
7+
)
58

69
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
710

811

912
class TestParseLuaHighlightsAnnotations(unittest.TestCase):
10-
1113
def test_parse_lua_highlights_annotations(self):
1214
# Define the path to the Lua file
13-
filepath = os.path.join("Ali Abdaal - Feel-Good Productivity_ How to Do More of What Matters to You.sdr/metadata.epub.lua")
15+
filepath = os.path.join(
16+
"Ali Abdaal - Feel-Good Productivity_ How to Do More of What Matters to You.sdr/metadata.epub.lua"
17+
)
1418
filepath = os.path.join(ROOT_DIR, "resources", filepath)
1519

1620
# Call the function with the actual Lua file
@@ -22,16 +26,20 @@ def test_parse_lua_highlights_annotations(self):
2226
"authors": "Abdaal, Ali",
2327
"language": "en-US",
2428
"entries": [
25-
{'chapter': 'Introduction',
26-
'datetime': '2024-08-30 12:31:05',
27-
'notes': 'when we’re in a positive mood, we tend to consider a broader range '
28-
'of actions, be more open to new experiences, and better integrate '
29-
'the information we receive',
30-
'page': 14},
31-
{'chapter': 'Introduction',
32-
'datetime': '2024-08-30 12:31:27',
33-
'notes': 'feeling good boosts our creativity –',
34-
'page': 15}
29+
{
30+
"chapter": "Introduction",
31+
"datetime": "2024-08-30 12:31:05",
32+
"notes": "when we’re in a positive mood, we tend to consider a broader range "
33+
"of actions, be more open to new experiences, and better integrate "
34+
"the information we receive",
35+
"page": 14,
36+
},
37+
{
38+
"chapter": "Introduction",
39+
"datetime": "2024-08-30 12:31:27",
40+
"notes": "feeling good boosts our creativity –",
41+
"page": 15,
42+
},
3543
],
3644
}
3745

@@ -43,7 +51,9 @@ def test_parse_lua_highlights_annotations(self):
4351

4452
def test_parse_lua_highlights_bookmarks(self):
4553
# Define the path to the Lua file
46-
filepath = os.path.join("Wallace J. Nichols - Blue Mind_ How Water Makes You Happier_ More Connected and Better at What You Do.sdr/metadata.epub.lua")
54+
filepath = os.path.join(
55+
"Wallace J. Nichols - Blue Mind_ How Water Makes You Happier_ More Connected and Better at What You Do.sdr/metadata.epub.lua"
56+
)
4757
filepath = os.path.join(ROOT_DIR, "resources", filepath)
4858

4959
# Call the function with the actual Lua file
@@ -55,13 +65,15 @@ def test_parse_lua_highlights_bookmarks(self):
5565
"authors": "Céline Cousteau\nWallace J. Nichols",
5666
"language": "en",
5767
"entries": [
58-
{'chapter': '3. The Water Premium',
59-
'datetime': '2021-02-15 14:28:25',
60-
'notes': 'The factors that help boost Ryan Howell’s happiness for the longer '
61-
'term are the pursuit and attainment of personal goals and the '
62-
'adoption of meaningful activities. Suppose that Howell was '
63-
'planning',
64-
'page': '12'}
68+
{
69+
"chapter": "3. The Water Premium",
70+
"datetime": "2021-02-15 14:28:25",
71+
"notes": "The factors that help boost Ryan Howell’s happiness for the longer "
72+
"term are the pursuit and attainment of personal goals and the "
73+
"adoption of meaningful activities. Suppose that Howell was "
74+
"planning",
75+
"page": "12",
76+
}
6577
],
6678
}
6779

@@ -72,5 +84,5 @@ def test_parse_lua_highlights_bookmarks(self):
7284
self.assertEqual(result["entries"], expected_metadata["entries"])
7385

7486

75-
if __name__ == '__main__':
87+
if __name__ == "__main__":
7688
unittest.main()

0 commit comments

Comments
 (0)