Coverage for src/robotide/editor/dialoghelps.py: 100%
22 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-05-06 10:40 +0100
« prev ^ index » next coverage.py v7.8.0, created at 2025-05-06 10:40 +0100
1# Copyright 2008-2015 Nokia Networks
2# Copyright 2016- Robot Framework Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
16import builtins 1qr
17from wx import GetTranslation 1qr
18from ..robotapi import ALIAS_MARKER 1qr
20_ = GetTranslation # To keep linter/code analyser happy 1qr
21builtins.__dict__['_'] = GetTranslation 1qr
23PH_ESCAPE ="%(ESCAPE)s" # PH = Place Holder 1qr
24INHERIT_TAG = "Inherited tags are not shown in this view." 1qr
25PH_TAGS = "%(TAG)s" 1qr
26PH_FIXTURE = "%(FIXTURE)s" 1qr
28def get_help(title): 1qr
29 _HELPS = {} 1abcdefghijklmnop
30 _EXAMPLES = { 1abcdefghijklmnop
31 'ESCAPE': _("Possible pipes in the value must be escaped with a backslash like '\\|'."),
32 'TAG': _("Separate tags with a pipe character like 'tag | second tag | 3rd'."),
33 'FIXTURE': _("Separate possible arguments with a pipe character like 'My Keyword | arg 1 | arg 2'."),
34 'TIMEOUT': _("Use time syntax like '1min 10s' or '2 hours' or give the value as seconds.\n"
35 "Before Robot v3.0.1 an optional message could have been specified like "
36 "'3 minutes | My message here'."),
37 'ARGUMENTS': _("Specify the arguments separated with a pipe character like '${arg1} | ${arg2}'.\n"
38 "Default values are given using equal sign and the last argument can be a list variable.\n"
39 "Example: '${arg1} | ${arg2}=default value | @{rest}'.\n"
40 "Note. You can use variable shortcuts in this field."),
41 'ALIAS': _("Alias can be used to import same library multiple times with different names.\n"
42 "Alias is prepended with: ") + ALIAS_MARKER +
43 _(" . Note that since Robot v6.0, imports with old WITH NAME are replaced by AS.")
44 }
45 content = ['', "Scalar Variable", _("Give name and value of the variable."), '', "List Variable", 1abcdefghijklmnop
46 _("Give name and value of the variable. Input list variable items into separate cells."), '',
47 "Dictionary Variable",
48 _("Give name and value of the variable. Input dictionary items into separate cells."),
49 _("Individual items must be in format `key=value`"), '', "Library",
50 _("Give name, optional arguments and optional alias of the library to import."),
51 _("Separate multiple arguments with a pipe character like 'arg 1 | arg 2'."), "%(ALIAS)s", '',
52 "Variables", _("Give path and optional arguments of the variable file to import."),
53 _("Separate multiple arguments with a pipe character like 'arg 1 | arg 2'."), PH_ESCAPE, '',
54 "Resource", _("Give path to the resource file to import."),
55 _("Existing resources will be automatically loaded to the resource tree."),
56 _("New resources must be created separately."), '', "Documentation", _("Give the documentation."),
57 _("Simple formatting like *bold* and _italic_ can be used."),
58 _("Additionally, URLs are converted to clickable links."), '', "Force Tags",
59 _("These tags are set to all test cases in this test suite."),
60 _(INHERIT_TAG), PH_TAGS, PH_ESCAPE, '', "Default Tags",
61 _("These tags are set to all test cases in this test suite unless test cases have their own tags."),
62 PH_TAGS, PH_ESCAPE, '', "Test Tags",
63 _("These tags are applied to all test cases in this test suite. "
64 "This field exists since Robot Framework 6.0 and will replace "
65 "Force and Default Tags after version 7.0."), _(INHERIT_TAG),
66 PH_TAGS, PH_ESCAPE, '', "Tags",
67 _("These tags are set to this test case in addition to "
68 "Force Tags and they override possible Default Tags."),
69 _(INHERIT_TAG), PH_TAGS, PH_ESCAPE, '', "Suite Setup",
70 _("This keyword is executed before executing any of the test cases or lower level suites."),
71 PH_FIXTURE, PH_ESCAPE, '', "Suite Teardown",
72 _("This keyword is executed after all test cases and lower level suites have been executed."),
73 PH_FIXTURE, PH_ESCAPE, '', "Test Setup",
74 _("This keyword is executed before every test case in this suite unless test cases override it."),
75 PH_FIXTURE, PH_ESCAPE, '', "Test Teardown",
76 _("This keyword is executed after every test case in this suite unless test cases override it."),
77 PH_FIXTURE, PH_ESCAPE, '', "Setup",
78 _("This keyword is executed before other keywords in this test case or keyword."),
79 _("In test cases, overrides possible Test Setup set on the suite level."),
80 _("Setup in keywords exists since Robot v7.0."), PH_FIXTURE, PH_ESCAPE, '', "Teardown",
81 _("This keyword is executed after other keywords in this test case or keyword even if the test or "
82 "keyword fails."),
83 _("In test cases, overrides possible Test Teardown set on the suite level."),
84 PH_FIXTURE, PH_ESCAPE, '', "Test Template",
85 _("Specifies the default template keyword used by tests in this suite."),
86 _("The test cases will contain only data to use as arguments to that keyword."), '', "Template",
87 _("Specifies the template keyword to use."),
88 _("The test itself will contain only data to use as arguments to that keyword."), '', "Arguments",
89 "%(ARGUMENTS)s", PH_ESCAPE, '', "Return Value",
90 _("Specify the return value. Use a pipe character to separate multiple values."), PH_ESCAPE,
91 "The '[Return]' setting is deprecated since Robot v7.0. Use the 'RETURN' statement instead.", '',
92 "Test Timeout",
93 _("Maximum time test cases in this suite are allowed to execute before aborting them forcefully."),
94 _("Can be overridden by individual test cases using Timeout setting."), "%(TIMEOUT)s", '', "Timeout",
95 _("Maximum time this test/keyword is allowed to execute before aborting it forcefully."),
96 _("With test cases this setting overrides Test Timeout set on the suite level."), "%(TIMEOUT)s", '',
97 "Metadata", _("Give a name and a value for the suite metadata."), '', "New Test Case",
98 _("Give a name for the new test case."), '', "New User Keyword",
99 _("Give a name and arguments for the new user keyword."), "%(ARGUMENTS)s", '',
100 "Copy User Keyword", _("Give a name for the new user keyword.")]
101 current = None 1abcdefghijklmnop
102 for row in content: 1abcdefghijklmnop
103 row = row.strip() 1abcdefghijklmnop
104 if not row: 1abcdefghijklmnop
105 current = None 1abcdefghijklmnop
106 elif current is None: 1abcdefghijklmnop
107 current = _HELPS.setdefault(row, []) 1abcdefghijklmnop
108 else:
109 current.append(row % _EXAMPLES) 1abcdefghijklmnop
111 return '\n'.join(_HELPS[title]) 1abcdefghijklmnop