Commit Graph

121 Commits

Author SHA1 Message Date
Bob Swift
7ee6b44241 Disable failing test using Russia as locale. 2021-05-31 14:46:47 -06:00
Bob Swift
75583f3e9f Test using both Russian and English locales 2021-05-31 14:46:47 -06:00
Bob Swift
eb34f66c1a Return country name in currently active UI language. 2021-05-31 14:46:47 -06:00
Bob Swift
27324e8259 Add script $countryname() function. 2021-05-31 14:46:46 -06:00
Philipp Wolfer
c80e7ea758 PICARD-2214: Fix exception if script ends with backslash 2021-05-28 13:14:07 +02:00
Philipp Wolfer
2acdeb77d9 PICARD-2204: Handle EOF when reading "\u" 2021-05-05 12:45:42 +02:00
Philipp Wolfer
5f6e8a0a25 PICARD-2204: Allow Unicode escape sequences in tagger script
This allows specifying Unicode characters as 4 digit hex values with e.g. \uFFFF.
2021-05-05 12:45:42 +02:00
Bob Swift
83074c3c9a Strip empty elements in MultiValue class. Fix $replacemulti() test. 2021-04-12 09:54:39 -06:00
Bob Swift
ba862a14f8 Add one test line to better check the return value of the function 2021-04-11 13:29:23 -06:00
Bob Swift
61f9a6e04e Refactor code slightly and improve test to better reflect the process 2021-04-11 13:13:30 -06:00
Bob Swift
65afbbf2a1 Remove duplication from test 2021-04-11 12:03:01 -06:00
Bob Swift
58148d6118 Remove empty elements from $map() output 2021-04-11 11:46:46 -06:00
Wieland Hoffmann
0d92ddbdaf PICARD-2182: Fix the no-op codepath of $replacemulti
Previously,

> $replacemulti(%foo%,A,,)

fails with

> "Expected str instance, ScriptExpression found"

Eval the ScriptExpression to get the real value.
2021-04-11 11:41:57 +02:00
Adam James
4c2bc9801b Add script function to replace entries in multi-value variables 2021-04-09 08:50:49 +02:00
Bob Swift
d0335e71a8 Clean up sorted() parameter. Change name to $unique() 2021-03-28 11:47:44 -06:00
Bob Swift
6604d38c60 Add function to remove duplicate entries from multi-value variable 2021-03-27 11:35:07 -06:00
Philipp Wolfer
c0e6243a13 PICARD-1926: Adjust test cases for new config structure 2020-12-25 12:37:15 +01:00
Philipp Wolfer
048651fa41 Refactor script module into package 2020-07-19 21:30:56 +02:00
Laurent Monin
a308c39343 preprocessor -> postprocessor
Suggested by @phw
2020-05-13 11:05:11 +02:00
Laurent Monin
7ec406f8bd Display module for script functions registered outside picard 2020-05-13 11:05:10 +02:00
Laurent Monin
06c2618232 Improve script function documentation formatting, using dl/dt/dd html tags
Make color of the first line configurable (demo mode)
2020-05-13 11:05:10 +02:00
Laurent Monin
66632e9761 Sort script functions documentation 2020-05-13 11:05:10 +02:00
Laurent Monin
d52bfd83b1 Make markdown module optional, fix tests accordingly 2020-05-13 11:05:09 +02:00
Laurent Monin
b284c841c4 Also test FunctionRegistryItem() 2020-05-13 11:05:09 +02:00
Laurent Monin
7d0e185a85 Fix up script function documentation tests
- ensure registry is empty
- use actual html code as returned by markdown
- split code among different test methods
2020-05-13 11:05:09 +02:00
Laurent Monin
7508cbf743 Reduce code redundancy, add helpers assertStartswith() and assertEndswith() 2020-05-13 11:05:09 +02:00
Laurent Monin
310bed488a Add script_function_documentation_all() to dump all script functions documentation 2020-05-13 11:05:09 +02:00
Laurent Monin
a7680bf75e script_function_documentation(): returns function doc in wanted format, add tests 2020-05-13 11:05:09 +02:00
Philipp Wolfer
fb83a8e76b Enable flake8 E265: Block comment should start with '# '
Most changes involve replacing non-breaking space with a simple space after the #.
2020-05-13 11:03:13 +02:00
Philipp Wolfer
909ea667b8 Check code style of tests with flake8 2020-05-13 11:03:13 +02:00
Philipp Wolfer
a3bb51993f PICARD-1813: Fixed calling $title with empty value 2020-05-09 10:46:57 +02:00
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