-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add testing support #88
Closed
Closed
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a5ffada
Add testing support
Hidorikun 55775c2
Merge branch 'main' into test-support
Hidorikun 3fb442c
Add parametrized dependency
Hidorikun 11a357f
Fix imports to work with Visual Studio and with Terminal
Hidorikun f4c2e8e
Add PyTest dependency and update the documentation
Hidorikun e1ba7e2
Rename requirements-prod.txt to requirements.txt
Hidorikun 80ec766
Update ts_core.py
Hidorikun d583916
Restore appid
Hidorikun 87d535b
Leave only dev requirements in the requirements-dev file
Hidorikun c9423fe
Merge branch 'main' into test-support
CyanVoxel File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
humanfriendly==10.0 | ||
opencv_python>=4.8.0.74,<=4.9.0.80 | ||
Pillow==10.3.0 | ||
pillow_avif_plugin>=1.3.1,<=1.4.3 | ||
PySide6>=6.5.1.1,<=6.6.3.1 | ||
PySide6_Addons>=6.5.1.1,<=6.6.3.1 | ||
PySide6_Essentials>=6.5.1.1,<=6.6.3.1 | ||
typing_extensions>=3.10.0.0,<=4.11.0 | ||
ujson>=5.8.0,<=5.9.0 | ||
pytest==8.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
VERSION: str = '9.2.0' # Major.Minor.Patch | ||
VERSION_BRANCH: str = 'Alpha' # 'Alpha', 'Beta', or '' for Full Release | ||
|
||
# The folder & file names where TagStudio keeps its data relative to a library. | ||
TS_FOLDER_NAME: str = '.TagStudio' | ||
BACKUP_FOLDER_NAME: str = 'backups' | ||
COLLAGE_FOLDER_NAME: str = 'collages' | ||
LIBRARY_FILENAME: str = 'ts_library.json' | ||
|
||
# TODO: Turn this whitelist into a user-configurable blacklist. | ||
IMAGE_TYPES: list[str] = ['png', 'jpg', 'jpeg', 'jpg_large', 'jpeg_large', | ||
'jfif', 'gif', 'tif', 'tiff', 'heic', 'heif', 'webp', | ||
'bmp', 'svg', 'avif', 'apng', 'jp2', 'j2k', 'jpg2'] | ||
VIDEO_TYPES: list[str] = ['mp4', 'webm', 'mov', 'hevc', 'mkv', 'avi', 'wmv', | ||
'flv', 'gifv', 'm4p', 'm4v', '3gp'] | ||
AUDIO_TYPES: list[str] = ['mp3', 'mp4', 'mpeg4', 'm4a', 'aac', 'wav', 'flac', | ||
'alac', 'wma', 'ogg', 'aiff'] | ||
DOC_TYPES: list[str] = ['txt', 'rtf', 'md', | ||
'doc', 'docx', 'pdf', 'tex', 'odt', 'pages'] | ||
PLAINTEXT_TYPES: list[str] = ['txt', 'md', 'css', 'html', 'xml', 'json', 'js', | ||
'ts', 'ini', 'htm', 'csv', 'php', 'sh', 'bat'] | ||
SPREADSHEET_TYPES: list[str] = ['csv', 'xls', 'xlsx', 'numbers', 'ods'] | ||
PRESENTATION_TYPES: list[str] = ['ppt', 'pptx', 'key', 'odp'] | ||
ARCHIVE_TYPES: list[str] = ['zip', 'rar', 'tar', 'tar.gz', 'tgz', '7z'] | ||
PROGRAM_TYPES: list[str] = ['exe', 'app'] | ||
SHORTCUT_TYPES: list[str] = ['lnk', 'desktop', 'url'] | ||
|
||
ALL_FILE_TYPES: list[str] = IMAGE_TYPES + VIDEO_TYPES + AUDIO_TYPES + \ | ||
DOC_TYPES + SPREADSHEET_TYPES + PRESENTATION_TYPES + \ | ||
ARCHIVE_TYPES + PROGRAM_TYPES + SHORTCUT_TYPES | ||
|
||
BOX_FIELDS = ['tag_box', 'text_box'] | ||
TEXT_FIELDS = ['text_line', 'text_box'] | ||
DATE_FIELDS = ['datetime'] | ||
|
||
TAG_COLORS = ['', 'black', 'dark gray', 'gray', 'light gray', 'white', 'light pink', | ||
'pink', 'red', 'red orange', 'orange', 'yellow orange', 'yellow', | ||
'lime', 'light green', 'mint', 'green','teal', 'cyan', 'light blue', | ||
'blue', 'blue violet', 'violet', 'purple', 'lavender', 'berry', | ||
'magenta', 'salmon', 'auburn', 'dark brown', 'brown', 'light brown', | ||
'blonde', 'peach', 'warm gray', 'cool gray', 'olive'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
from src.core.library import Tag | ||
from tagstudio.src.core.library import Tag | ||
|
||
|
||
class TestTags: | ||
def test_construction(self): | ||
tag = Tag(id=1, name='Tag Name', shorthand='TN', aliases=[ | ||
'First A', 'Second A'], subtags_ids=[2, 3, 4], color='') | ||
assert (tag) | ||
def test_construction(): | ||
tag = Tag(id=1, name='Tag Name', shorthand='TN', aliases=[ | ||
'First A', 'Second A'], subtags_ids=[2, 3, 4], color='') | ||
assert tag | ||
|
||
def test_empty_construction(self): | ||
tag = Tag(id=1, name='', shorthand='', aliases=[], subtags_ids=[], color='') | ||
assert (tag) | ||
def test_empty_construction(): | ||
tag = Tag(id=1, name='', shorthand='', aliases=[], subtags_ids=[], color='') | ||
assert tag |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import pytest | ||
|
||
from src.core.utils.str import strip_punctuation | ||
|
||
@pytest.mark.parametrize("text, expected", [ | ||
('{[(parenthesis)]}', 'parenthesis'), | ||
('‘“`"\'quotes\'"`”’', 'quotes'), | ||
('_- spacers', 'spacers'), | ||
('{}[]()\'"`‘’“”- ', '') | ||
]) | ||
def test_strip_punctuation(text, expected): | ||
assert strip_punctuation(text) == expected |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was probably some misunderstanding, but these dependencies should remain only in
requirements.txt
, otherwise these files will get out of sync sooner or later and it will cause problems.If you really want to have everything installed via a single dependency file, put here
-r requirements.txt
isntead. Otherwise I think both these files should be independent from each other. Ie.requirements.txt
for installing production dependencies,requirements-dev.txt
for developers' dependencies.