Commit Graph

90 Commits

Author SHA1 Message Date
Bob Swift
2b07885c69 Add missing formatting code. Update test for missing code. 2020-03-06 14:18:57 -07:00
Bob Swift
46937bab8b Combine StackItem classes into one. Standardize exception prefix text. 2020-03-06 10:18:07 -07:00
Bob Swift
d5de2dc159 Use StackItem and FunctionStackItem with script exception calls 2020-03-05 15:35:16 -07:00
Bob Swift
61d9196b92 Fix function line, column in ScriptRuntimeError. Add tests. 2020-03-04 16:14:45 -07:00
Bob Swift
462ba2d74b Remove unnecessary "except..." code. 2020-03-03 15:17:14 -07:00
Bob Swift
1ccaebb28f Fix line, position order and add line number to test. 2020-03-03 15:07:33 -07:00
Bob Swift
64a379aeb2 Use thread-safe function stack. Add platform-specific tests. 2020-03-03 15:07:32 -07:00
Bob Swift
030fd17251 Add function_stack to parser. Revise ScriptRuntimeError args. 2020-03-03 15:06:07 -07:00
Bob Swift
5a8df90074 Added ScriptRuntimeError. Remove unnecessary non-Win tests. 2020-03-03 15:05:42 -07:00
Bob Swift
1c1f2998f4 Trap ValueError exception in $datetime function and add tests 2020-03-03 15:04:19 -07:00
Bob Swift
60d9827fa6 PICARD-1781: Have $find return '' rather than '-1' on not found 2020-03-03 17:19:02 +00:00
Bob Swift
becd3e0d7a Add IndexError check to $firstwords function 2020-02-28 07:47:38 +00:00
Philipp Wolfer
c1c9cf6bf6 PICARD-1774: Fix MultiValue returning [] on empty value
This also fixes issues with some functions:
- $lenmulti with empty value must return 0
- $foreach and $map must loop zero times on empty value
2020-02-27 08:25:01 +00:00
Bob Swift
05ea186c29 Fix negative length handling in $num 2020-02-26 22:25:44 +00:00
Bob Swift
1bd45a0c59 Add ZeroDivisionError handling in $mod function 2020-02-26 22:22:47 +00:00
Laurent Monin
6b5e852a60 Run fix-header on *.py 2020-02-24 10:25:09 +01:00
Bob Swift
170b8e0aa7 Add $sortmulti, $reversemulti and associated tests 2020-02-22 19:24:13 +00:00
Laurent Monin
6365295ee4 Add tests for MultiValue
100% coverage on the class
2020-02-21 21:04:24 +01: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
Bob Swift
7762f9b929 Add $datetime() function and associated tests 2020-02-07 00:49:35 +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
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
2c35d76b75 PICARD-1667: Functions for boolean checks must return "" on False 2019-11-12 11:47:42 +01:00
Philipp Wolfer
d304e30dc2 PICARD-1594: Set ~video variable on file loading based on extension
This does not give a 100% coverage of detecting files which include video, but at least those files are supposed to be video files.
2019-09-11 08:49:00 +02:00
Philipp Wolfer
6ba10be54b PICARD-1594: Add $is_video() and $is_audio() scripting functions 2019-09-10 17:45:58 +02:00
Philipp Wolfer
a66b66d3d4 Increased test coverage for scripting tests 2019-09-07 20:54:12 +02:00
Philipp Wolfer
d34cf8147b PICARD-1556: Added line breaks to file naming script for readability 2019-08-05 15:18:45 +02:00
Philipp Wolfer
3c5f1114a8 PICARD-1517: Fix running matchedtracks()/is_complete() on clusters 2019-05-31 06:05:10 +00:00
Laurent Monin
2848b76f1c Improve script tests: use assertRaisesRegex() and remove useless self.fail()
Suggested by Mineo
2019-04-25 14:14:45 +02:00
Laurent Monin
437c55ea2e Make wrong number of arguments script error message more explicit, along tests 2019-04-19 10:05:21 +02:00
Philipp Wolfer
dd4da2aa47 Updated isort config to put test imports in separate section 2019-04-04 08:32:22 +02:00
Laurent Monin
0f1ca5379a Move to DEFAULT_FILE_NAMING_FORMAT to picard.const 2019-04-02 14:06:49 +02:00
Philipp Wolfer
3ec9c7c5e4 Merge pull request #1023 from phw/PICARD-637-fix-matchedtracks
PICARD-637: Allow $matchedtracks any number of args
2018-10-31 08:33:46 +01:00
virusMac
8cc47a7680 PICARD-862: Add tests for func_pad, func_replace, func_strip (#1022) 2018-10-31 08:33:02 +01:00
Philipp Wolfer
b18fbc77b2 Added tests for $matchedtracks 2018-10-29 13:34:02 +01:00
virusMac
3310f9914e PICARD-1386: Add $title function (#1018)
PICARD-1386: Add $title function
2018-10-29 08:34:54 +01:00
Wieland Hoffmann
e624aa121c Make PicardTestCase the parent class of all tests
This brings the faketagger and, more importantly, settings reset to all of them.
2018-10-23 17:32:50 +02:00
Laurent Monin
5329e3592a Clean up and sort imports using isort
Add a config for isort (https://github.com/timothycrosley/isort)
Run isort -rc . and make import style consistent across files
Add a note about `isort` in CONTRIBUTING.md
2018-08-22 08:51:25 +02:00
Sophist
c067bd5e26 Merge branch 'master' into PICARD-922_improve-inmulti-as-per-1.4.1 2017-05-11 08:26:15 +01:00