Commit Graph

700 Commits

Author SHA1 Message Date
Philipp Wolfer
7e937e851a PICARD-1765: Adding / removing preserved tags must normalize the tags 2020-02-24 08:49:22 +00:00
Laurent Monin
b5a97c9926 Merge pull request #1493 from zas/cov_cleanup
Coverage & cleanup
2020-02-24 00:34:49 +01:00
Laurent Monin
3585d40b0b PICARD-1762: fix broken PDF identification
In identify(), comparaison was done against `str` instead of `bytecode`, due to the lack of `b` prefix

ImageInfoTest: add missing test PDF file identification
2020-02-23 13:07:30 +00:00
Laurent Monin
ed351fbbd6 ImageInfoTest: remove useless ending comma 2020-02-22 21:04:32 +01:00
Laurent Monin
77a9d0110a AlbumArtistFromPathTest: add a bunch of missing tests 2020-02-22 21:04:32 +01:00
Laurent Monin
27f04356d5 TranslateArtistTest: ensure name is returned in latin-only case
The previous test wasn't that good as a reversed sortname could actually assert true
2020-02-22 21:04:32 +01:00
Laurent Monin
af5e9d647e TranslateArtistTest: improve coverage
Cases with non-latin and 3 or 4 chunks were missing
2020-02-22 21:04:32 +01:00
Laurent Monin
bd95736da4 TranslateArtistTest: u"" -> "" (Python3) 2020-02-22 21:04:32 +01:00
Laurent Monin
64bfb17733 TranslateArtistTest: remove useless assertNotEqual()
Since we assert a equals b, no need to assert a not equal c when b & c are different
Coverage is unchanged.
2020-02-22 21:04:32 +01:00
Laurent Monin
42d0a72b74 Improve coverage of union_sorted_lists() tests 2020-02-22 21:04:32 +01:00
Bob Swift
170b8e0aa7 Add $sortmulti, $reversemulti and associated tests 2020-02-22 19:24:13 +00:00
Laurent Monin
3f25bda3c8 Fix a bunch of flake8 warnings, mostly cosmetic changes 2020-02-21 21:43:40 +01:00
Laurent Monin
6365295ee4 Add tests for MultiValue
100% coverage on the class
2020-02-21 21:04:24 +01:00
Laurent Monin
0860e1db15 Merge pull request #1486 from zas/scriptfunctions_cov
Improve script functions test coverage
2020-02-20 22:50:17 +01:00
Philipp Wolfer
b40a3cb9cd PICARD-1756: Fix plugin update version comparison
Use Version class to implement version comparison. Fixes updater considering 1.10 < 1.9
2020-02-20 21:18:07 +00:00
Laurent Monin
6f9b171d1c Test script_function decorator
Changes were made to ensure ScriptParser registry is resetted on each test
2020-02-20 21:54:06 +01:00
Laurent Monin
ccf6edfbd9 Complete multi functions tests 2020-02-20 21:06:09 +01:00
Laurent Monin
037a487710 $title: test all cases, and drop test for empty text which cannot happen 2020-02-20 21:06:09 +01:00
Laurent Monin
37631e8ad7 $rsearch: test unmatched regex 2020-02-20 21:06:09 +01:00
Laurent Monin
5b1cfc5470 $div: test non-numeric parameter 2020-02-20 21:06:09 +01:00
Laurent Monin
665a3e9885 $div: Test and handle division by zero error 2020-02-20 21:06:09 +01:00
Laurent Monin
55ad8a3924 Test various unknown functions and unexpected script errors 2020-02-20 21:06:09 +01:00
Laurent Monin
0da4ab5d74 Tidy up script tests
Remove useless whitespaces
Fix typo in comment
test_optional_kwonly_parameters(): self is unused -> static method
Use raw string notation
2020-02-20 20:53:02 +01:00
Philipp Wolfer
7e350da299 Refactor File to handle acoustid_fingerprint
acoustid_fingerprint is now a normal attribute of File and always available. Adding and removing the file to and from the AcoustIDManager is now completely handled in File.
2020-02-20 07:29:51 +00:00
Philipp Wolfer
800f61e6b6 PICARD-1752: Use the first matching preferred release country
For releases with multiple release countries use the first matching preferred release country for %releasecountry%.
2020-02-19 21:55:23 +00:00
Philipp Wolfer
7539d8dc23 PICARD-1751: Provide a ~releasecountries variable 2020-02-19 21:55:23 +00:00
Laurent Monin
fd25dc987d PICARD-1748: limit number of countries displayed to 10 2020-02-19 20:11:58 +00:00
Philipp Wolfer
c018f076ea PICARD-1739: Use new Version class for version comparison in update check
Fixes update check not properly comparing alpha, beta and rc releases.
2020-02-11 23:03:20 +01:00
Philipp Wolfer
dce902f192 PICARD-1688: Added tests for AcoustID submission 2020-02-11 13:35:04 +01:00
Laurent Monin
0631e5ff28 Move copy_file_tmp() and remove_file_tmp() to PicardTestCase
It helps to reduce code redundancy.
2020-02-08 18:04:39 +01:00
Laurent Monin
64291c309c Use NamedTemporaryFile instead of mkstemp 2020-02-08 18:04:39 +01:00
Laurent Monin
498c8eab1b Add mktmpdir method to PicardTestCase, and use it more widely 2020-02-08 18:04:39 +01:00
Laurent Monin
b7389a6445 Tests: ensure temporary directories and files are removed after tests
- QSettings object needs special care, as file was re-created on exit
- Append a cleanup function as soon as possible to ensure temporary dirs & files are removed in any case
- prefer addCleanup() over tearDown(), keeping creation and cleanup together
2020-02-08 18:04:39 +01:00
Bob Swift
7762f9b929 Add $datetime() function and associated tests 2020-02-07 00:49:35 +01:00
Philipp Wolfer
7c6929286b Apply utime test workaround for all macOS versions.
This also seems not only on the macOS version but also on the Python build being used. On the build server with macOS 10.15 this works with the Python binaries provided on the server, but fails with official binaries from python.org.
2020-02-06 19:55:42 +01:00
Bob Swift
3903007a79 Add $slice() function and associated tests 2020-02-03 14:58:16 -07:00
Bob Swift
761c49124a Add $join() function and associated tests 2020-02-03 12:24:26 -07:00
Philipp Wolfer
d653270b71 PICARD-1723: Consider disc number when comparing metadata
Improves results when matching files to multi-disc albums.
2020-02-03 11:16:52 +01:00
Laurent Monin
52b80593ac Unify new and old script function names
Before introduction of new functions, we had a pattern: "name" script function was defined by "func_name"
Recent patches changed this, introducing inconsistencies.
Also we have inmulti and lenmulti, so stick to this scheme for getmulti and others.

func_find_str -> func_find
find_str -> find
func_reverse_str -> func_reverse
reverse_str -> reverse
func_get_multi -> func_getmulti
func_foreach_multi -> func_foreach
func_while_loop -> func_while
func_map_multi -> func_map
2020-02-01 18:07:38 +01:00
Philipp Wolfer
3d2a5cf250 PICARD-1719: Fix $unset must not mark tags for deletion.
This regressed in Picard 2.2.0 with commit 503b520 and $unset behaves the same as $delete.
2020-01-31 18:09:07 +01:00
Bob Swift
0bea47fcdf Add tests on missing inputs. 2020-01-31 08:20:58 -07:00
Bob Swift
9ac7fd290b Add tests for new functions. 2020-01-30 19:31:41 -07:00
Philipp Wolfer
a9cb192f00 PICARD-1646: Consider release types for AcoustId results
Make the release primary and secondary type as provided by AcoustId available to the matching.
2020-01-29 19:25:36 +01:00
Philipp Wolfer
1799011eb6 PICARD-1715: Add new script_to_filename_with_metadata function
Keep existing script_to_filename function with same behavior as before
2020-01-28 15:14:47 +01:00
Philipp Wolfer
bcc81d86eb PICARD-1715: Allow changing file extension in renaming script 2020-01-28 13:41:27 +01:00
Philipp Wolfer
c52519d91a PICARD-239: Handle tags like "comment" and "comment:" the same
Some of Picard's tag names allow an additional description separated by a colon, e.g. "comment:desc". In case the description part is empty and the tag ends on a colon this is now treated the same as without any colon. So "lyrics" and "lyrics:" are the same tag.

Handling this in Metadata makes this change immediately available in scripting and to all formats. Script using both forms will still work.
2020-01-26 17:07:42 +01:00
Laurent Monin
aefbdb6a73 Move more code from Metadata to external small functions, test them 2020-01-23 18:01:28 +01:00
Laurent Monin
210e71b426 Pass parts to weights_from_release_type_scores() 2020-01-23 18:01:28 +01:00
Philipp Wolfer
8f745f1a0d PICARD-1711: Fix deleting lyrics tag from ASF, APE, ID3 files 2020-01-23 12:10:15 +01:00
Philipp Wolfer
4d85c2e31f PICARD-1589: Support language for ID3 comments.
Adds syntax "comment:{language}:{description}" in addition to existing "comment:{description}" for comment tag names.
2020-01-23 07:57:41 +01:00