Skip to content

Commit fcc649e

Browse files
committed
BuiltIn: Fine-tune documentation of new strip_spaces argument.
Add notes that this is new in RF 4.0. At the same time remove notes about features new in RF < 3.1. Related to issue robotframework#3240 and PR robotframework#3843.
1 parent 514f7cf commit fcc649e

File tree

1 file changed

+35
-50
lines changed

1 file changed

+35
-50
lines changed

src/robot/libraries/BuiltIn.py

Lines changed: 35 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -621,18 +621,17 @@ def should_be_equal(self, first, second, msg=None, values=True,
621621
If ``strip_spaces`` is given a true value (see `Boolean arguments`)
622622
and both arguments are strings, the comparison is done without leading
623623
and trailing spaces. If ``strip_spaces`` is given a string value
624-
``leading`` or ``trailing`` and both arguments are strings, the
625-
comparison is done without leading or trailing spaces respectively.
626-
The default value is ``False``.
624+
``LEADING`` or ``TRAILING`` (case-insensitive), the comparison is done
625+
without leading or trailing spaces, respectively.
627626
628627
Examples:
629628
| Should Be Equal | ${x} | expected |
630629
| Should Be Equal | ${x} | expected | Custom error message |
631630
| Should Be Equal | ${x} | expected | Custom message | values=False |
632631
| Should Be Equal | ${x} | expected | ignore_case=True | formatter=repr |
633632
634-
``ignore_case`` and ``formatter`` are new features in Robot Framework
635-
3.0.1 and 3.1.2, respectively.
633+
``formatter`` is new in Robot Framework 3.1.2 and ``strip_spaces`` is new
634+
in Robot Framework 4.0.
636635
"""
637636
self._log_types_at_info_if_different(first, second)
638637
if is_truthy(ignore_case) and is_string(first) and is_string(second):
@@ -698,11 +697,10 @@ def should_not_be_equal(self, first, second, msg=None, values=True,
698697
If ``strip_spaces`` is given a true value (see `Boolean arguments`)
699698
and both arguments are strings, the comparison is done without leading
700699
and trailing spaces. If ``strip_spaces`` is given a string value
701-
``leading`` or ``trailing`` and both arguments are strings, the
702-
comparison is done without leading or trailing spaces respectively.
703-
The default value is ``False``.
700+
``LEADING`` or ``TRAILING`` (case-insensitive), the comparison is done
701+
without leading or trailing spaces, respectively.
704702
705-
New option in Robot Framework 3.0.1.
703+
``strip_spaces`` is new in Robot Framework 4.0.
706704
"""
707705
self._log_types_at_info_if_different(first, second)
708706
if is_truthy(ignore_case) and is_string(first) and is_string(second):
@@ -821,14 +819,13 @@ def should_not_be_equal_as_strings(self, first, second, msg=None,
821819
If ``strip_spaces`` is given a true value (see `Boolean arguments`)
822820
and both arguments are strings, the comparison is done without leading
823821
and trailing spaces. If ``strip_spaces`` is given a string value
824-
``leading`` or ``trailing`` and both arguments are strings, the
825-
comparison is done without leading or trailing spaces respectively.
826-
The default value is ``False``.
822+
``LEADING`` or ``TRAILING`` (case-insensitive), the comparison is done
823+
without leading or trailing spaces, respectively.
827824
828825
Strings are always [http://www.macchiato.com/unicode/nfc-faq|
829826
NFC normalized].
830827
831-
``ignore_case`` is a new feature in Robot Framework 3.0.1.
828+
``strip_spaces`` is new in Robot Framework 4.0.
832829
"""
833830
self._log_types_at_info_if_different(first, second)
834831
first = self._convert_to_string(first)
@@ -855,15 +852,14 @@ def should_be_equal_as_strings(self, first, second, msg=None, values=True,
855852
If ``strip_spaces`` is given a true value (see `Boolean arguments`)
856853
and both arguments are strings, the comparison is done without leading
857854
and trailing spaces. If ``strip_spaces`` is given a string value
858-
``leading`` or ``trailing`` and both arguments are strings, the
859-
comparison is done without leading or trailing spaces respectively.
860-
The default value is ``False``.
855+
``LEADING`` or ``TRAILING`` (case-insensitive), the comparison is done
856+
without leading or trailing spaces, respectively.
861857
862858
Strings are always [http://www.macchiato.com/unicode/nfc-faq|
863859
NFC normalized].
864860
865-
``ignore_case`` and ``formatter`` are new features in Robot Framework
866-
3.0.1 and 3.1.2, respectively.
861+
``formatter`` is new in Robot Framework 3.1.2 and ``strip_spaces`` is new
862+
in Robot Framework 4.0.
867863
"""
868864
self._log_types_at_info_if_different(first, second)
869865
first = self._convert_to_string(first)
@@ -963,13 +959,14 @@ def should_not_contain(self, container, item, msg=None, values=True,
963959
If ``strip_spaces`` is given a true value (see `Boolean arguments`)
964960
and both arguments are strings, the comparison is done without leading
965961
and trailing spaces. If ``strip_spaces`` is given a string value
966-
``leading`` or ``trailing`` and both arguments are strings, the
967-
comparison is done without leading or trailing spaces respectively.
968-
The default value is ``False``.
962+
``LEADING`` or ``TRAILING`` (case-insensitive), the comparison is done
963+
without leading or trailing spaces, respectively.
969964
970965
Examples:
971966
| Should Not Contain | ${some list} | value |
972967
| Should Not Contain | ${output} | FAILED | ignore_case=True |
968+
969+
``strip_spaces`` is new in Robot Framework 4.0.
973970
"""
974971
# TODO: It is inconsistent that errors show original case in 'container'
975972
# 'item' is in lower case. Should rather show original case everywhere
@@ -1006,20 +1003,20 @@ def should_contain(self, container, item, msg=None, values=True,
10061003
If ``ignore_case`` is given a true value (see `Boolean arguments`) and
10071004
compared items are strings, it indicates that comparison should be
10081005
case-insensitive. If the ``container`` is a list-like object, string
1009-
items in it are compared case-insensitively. New option in Robot
1010-
Framework 3.0.1.
1006+
items in it are compared case-insensitively.
10111007
10121008
If ``strip_spaces`` is given a true value (see `Boolean arguments`)
10131009
and both arguments are strings, the comparison is done without leading
10141010
and trailing spaces. If ``strip_spaces`` is given a string value
1015-
``leading`` or ``trailing`` and both arguments are strings, the
1016-
comparison is done without leading or trailing spaces respectively.
1017-
The default value is ``False``.
1011+
``LEADING`` or ``TRAILING`` (case-insensitive), the comparison is done
1012+
without leading or trailing spaces, respectively.
10181013
10191014
Examples:
10201015
| Should Contain | ${output} | PASS |
10211016
| Should Contain | ${some list} | value | msg=Failure! | values=False |
10221017
| Should Contain | ${some list} | value | ignore_case=True |
1018+
1019+
``strip_spaces`` is new in Robot Framework 4.0.
10231020
"""
10241021
orig_container = container
10251022
if is_truthy(ignore_case) and is_string(item):
@@ -1059,8 +1056,6 @@ def should_contain_any(self, container, *items, **configuration):
10591056
| Should Contain Any | ${list} | item 1 | item 2 | item 3 |
10601057
| Should Contain Any | ${list} | item 1 | item 2 | item 3 | ignore_case=True |
10611058
| Should Contain Any | ${list} | @{items} | msg=Custom message | values=False |
1062-
1063-
New in Robot Framework 3.0.1.
10641059
"""
10651060
msg = configuration.pop('msg', None)
10661061
values = configuration.pop('values', True)
@@ -1114,8 +1109,6 @@ def should_not_contain_any(self, container, *items, **configuration):
11141109
| Should Not Contain Any | ${list} | item 1 | item 2 | item 3 |
11151110
| Should Not Contain Any | ${list} | item 1 | item 2 | item 3 | ignore_case=True |
11161111
| Should Not Contain Any | ${list} | @{items} | msg=Custom message | values=False |
1117-
1118-
New in Robot Framework 3.0.1.
11191112
"""
11201113
msg = configuration.pop('msg', None)
11211114
values = configuration.pop('values', True)
@@ -1158,22 +1151,20 @@ def should_contain_x_times(self, container, item, count, msg=None,
11581151
11591152
If ``ignore_case`` is given a true value (see `Boolean arguments`) and
11601153
compared items are strings, it indicates that comparison should be
1161-
case-insensitive.
1154+
case-insensitive. If the ``container`` is a list-like object, string
1155+
items in it are compared case-insensitively.
11621156
11631157
If ``strip_spaces`` is given a true value (see `Boolean arguments`)
11641158
and both arguments are strings, the comparison is done without leading
11651159
and trailing spaces. If ``strip_spaces`` is given a string value
1166-
``leading`` or ``trailing`` and both arguments are strings, the
1167-
comparison is done without leading or trailing spaces respectively.
1168-
The default value is ``False``.
1169-
1170-
If the ``container`` is a list-like object, string
1171-
items in it are compared case-insensitively. New option in Robot
1172-
Framework 3.0.1.
1160+
``LEADING`` or ``TRAILING`` (case-insensitive), the comparison is done
1161+
without leading or trailing spaces, respectively.
11731162
11741163
Examples:
11751164
| Should Contain X Times | ${output} | hello | 2 |
11761165
| Should Contain X Times | ${some list} | value | 3 | ignore_case=True |
1166+
1167+
``strip_spaces`` is new in Robot Framework 4.0.
11771168
"""
11781169
count = self._convert_to_integer(count)
11791170
orig_container = container
@@ -1223,13 +1214,11 @@ def should_not_match(self, string, pattern, msg=None, values=True,
12231214
``*``, ``?`` and ``[chars]`` acting as wildcards. See the
12241215
`Glob patterns` section for more information.
12251216
1226-
If ``ignore_case`` is given a true value (see `Boolean arguments`) and
1227-
compared items are strings, it indicates that comparison should be
1228-
case-insensitive.
1217+
If ``ignore_case`` is given a true value (see `Boolean arguments`),
1218+
the comparison is case-insensitive.
12291219
12301220
See `Should Be Equal` for an explanation on how to override the default
1231-
error message with ``msg`` and ``values``, as well as for semantics
1232-
of the ``ignore_case`` option.
1221+
error message with ``msg`` and ``values`.
12331222
"""
12341223
if self._matches(string, pattern, caseless=is_truthy(ignore_case)):
12351224
raise AssertionError(self._get_string_msg(string, pattern, msg,
@@ -1248,8 +1237,7 @@ def should_match(self, string, pattern, msg=None, values=True,
12481237
case-insensitive.
12491238
12501239
See `Should Be Equal` for an explanation on how to override the default
1251-
error message with ``msg`` and ``values``, as well as for semantics
1252-
of the ``ignore_case`` option.
1240+
error message with ``msg`` and ``values``.
12531241
"""
12541242
if not self._matches(string, pattern, caseless=is_truthy(ignore_case)):
12551243
raise AssertionError(self._get_string_msg(string, pattern, msg,
@@ -1620,7 +1608,7 @@ def set_task_variable(self, name, *values):
16201608
"""Makes a variable available everywhere within the scope of the current task.
16211609
16221610
This is an alias for `Set Test Variable` that is more applicable when
1623-
creating tasks, not tests. New in RF 3.1.
1611+
creating tasks, not tests. New in Robot Framework 3.1.
16241612
"""
16251613
self.set_test_variable(name, *values)
16261614

@@ -2131,8 +2119,6 @@ def repeat_keyword(self, repeat, name, *args):
21312119
| Repeat Keyword | 5 times | Go to Previous Page |
21322120
| Repeat Keyword | ${var} | Some Keyword | arg1 | arg2 |
21332121
| Repeat Keyword | 2 minutes | Some Keyword | arg1 | arg2 |
2134-
2135-
Specifying ``repeat`` as a timeout is new in Robot Framework 3.0.
21362122
"""
21372123
try:
21382124
count = self._get_repeat_count(repeat)
@@ -3567,8 +3553,7 @@ class BuiltIn(_Verify, _Converter, _Variables, _RunKeyword, _Control, _Misc):
35673553
| `Should Be Equal` | ${x} | ${y} | Custom error | values=${FALSE} | # Python ``False`` is false. |
35683554
| `Should Be Equal` | ${x} | ${y} | Custom error | values=no values | # ``no values`` works with ``values`` argument |
35693555
3570-
Considering string ``NONE`` false is new in Robot Framework 3.0.3 and
3571-
considering also ``OFF`` and ``0`` false is new in Robot Framework 3.1.
3556+
Considering strings ``OFF`` and ``0`` false is new in Robot Framework 3.1.
35723557
35733558
= Pattern matching =
35743559

0 commit comments

Comments
 (0)