mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-28 05:26:13 +02:00
add actual lib directory even though it's in gitignore for some reason
This commit is contained in:
parent
f99411f2f9
commit
d95dab9f0c
5 changed files with 819 additions and 0 deletions
40
tests/lib/helpers.py
Normal file
40
tests/lib/helpers.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
# Copyright (C) 2012-2021 jrnl contributors
|
||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
import os
|
||||
|
||||
|
||||
def does_directory_contain_files(file_list, directory_path):
|
||||
if not os.path.isdir(directory_path):
|
||||
return False
|
||||
|
||||
for file in file_list.split("\n"):
|
||||
fullpath = directory_path + "/" + file
|
||||
if not os.path.isfile(fullpath):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def parse_should_or_should_not(should_or_should_not):
|
||||
if should_or_should_not == "should":
|
||||
return True
|
||||
elif should_or_should_not == "should not":
|
||||
return False
|
||||
else:
|
||||
raise Exception(
|
||||
"should_or_should_not valid values are 'should' or 'should not'"
|
||||
)
|
||||
|
||||
|
||||
def assert_equal_tags_ignoring_order(
|
||||
actual_line, expected_line, actual_content, expected_content
|
||||
):
|
||||
actual_tags = set(tag.strip() for tag in actual_line[len("tags: ") :].split(","))
|
||||
expected_tags = set(
|
||||
tag.strip() for tag in expected_line[len("tags: ") :].split(",")
|
||||
)
|
||||
assert actual_tags == expected_tags, [
|
||||
[actual_tags, expected_tags],
|
||||
[expected_content, actual_content],
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue