4 new revisions:
Revision: cc846d40d3f9
Branch: default
Author: Robot Framework Developers (robotframew...@gmail.com)
Date: Thu Oct 3 11:59:11 2013 UTC
Log: UG: Small corrections to section about ignored data
http://code.google.com/p/robotframework/source/detail?r=cc846d40d3f9
Revision: 84b01951ca8c
Branch: default
Author: Robot Framework Developers (robotframew...@gmail.com)
Date: Thu Oct 3 11:59:33 2013 UTC
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=84b01951ca8c
Revision: 2bf805b6f616
Branch: default
Author: Robot Framework Developers (robotframew...@gmail.com)
Date: Thu Oct 3 12:01:12 2013 UTC
Log: String: move new Remove String keywords next to Replace String
keyword...
http://code.google.com/p/robotframework/source/detail?r=2bf805b6f616
Revision: 61b9f1961f70
Branch: default
Author: Robot Framework Developers (robotframew...@gmail.com)
Date: Thu Oct 3 12:41:20 2013 UTC
Log: String: Enhance docs of Replace/Remove String (Using Regexp)....
http://code.google.com/p/robotframework/source/detail?r=61b9f1961f70
==============================================================================
Revision: cc846d40d3f9
Branch: default
Author: Robot Framework Developers (robotframew...@gmail.com)
Date: Thu Oct 3 11:59:11 2013 UTC
Log: UG: Small corrections to section about ignored data
http://code.google.com/p/robotframework/source/detail?r=cc846d40d3f9
Modified:
/doc/userguide/src/CreatingTestData/TestDataSyntax.rst
=======================================
--- /doc/userguide/src/CreatingTestData/TestDataSyntax.rst Fri Sep 27
07:31:44 2013 UTC
+++ /doc/userguide/src/CreatingTestData/TestDataSyntax.rst Thu Oct 3
11:59:11 2013 UTC
@@ -523,11 +523,12 @@
- All tables that do not start with a recognized table name in the first
cell.
- Everything else on the first row of a table apart from the first cell.
-- Data outside tables in HTML/reST and data before the first table in TSV.
+- Data before the first table and also between tables if the data format
+ allows that.
- All empty rows, which means these kinds of rows can be used to make
the tables more readable.
-- All empty cells at the end of rows; you must add a backslash (\\) to
- prevent such cells from being ignored.
+- All empty cells at the end of rows; you must add a backslash (\\) or
`built-in
+ variable`__ :var:`${EMPTY}` to prevent such cells from being ignored.
- All single backslashes (\\); they are used as an escape character.
- All characters following a hash mark (#), if it is the first
character of a cell; this means that hash marks can be used to enter
@@ -537,10 +538,11 @@
When Robot Framework ignores some data, this data is not available in
any resulting reports and, additionally, most tools used with Robot
Framework also ignore them. To add information that is visible in
-Robot Framework outputs, or available to, for example, RIDE_,
-place it to the documentation or other metadata of test cases or suites,
-or log with the :name:`Log` or :name:`Comment` keywords available
-from the BuiltIn_ library.
+Robot Framework outputs, place it to the documentation or other metadata of
+test cases or suites, or log it with the :name:`Log` or :name:`Comment`
keywords
+available from the BuiltIn_ library.
+
+__ `Space and empty variables`_
Escaping
''''''''
==============================================================================
Revision: 84b01951ca8c
Branch: default
Author: Robot Framework Developers (robotframew...@gmail.com)
Date: Thu Oct 3 11:59:33 2013 UTC
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=84b01951ca8c
==============================================================================
Revision: 2bf805b6f616
Branch: default
Author: Robot Framework Developers (robotframew...@gmail.com)
Date: Thu Oct 3 12:01:12 2013 UTC
Log: String: move new Remove String keywords next to Replace String
keywords they use internally
http://code.google.com/p/robotframework/source/detail?r=2bf805b6f616
Modified:
/src/robot/libraries/String.py
=======================================
--- /src/robot/libraries/String.py Thu Oct 3 09:55:08 2013 UTC
+++ /src/robot/libraries/String.py Thu Oct 3 12:01:12 2013 UTC
@@ -285,6 +285,59 @@
return string
return re.sub(pattern, replace_with, string, max(count, 0))
+ def remove_string(self, string, *removables):
+ """Removes `removables` in the given `string`.
+
+ `removables` are used as literal strings. Each removable will be
+ matched to a temporary string from which preceding removables have
+ been already removed. See second example below.
+
+ See `Remove String Using Regexp` if more powerful pattern matching
is needed.
+
+ If you need to remove a certain number of matches use `Replace
String` to
+ replace certain count with empty string.
+
+ A modified version of the string is returned and the original
+ string is not altered.
+
+ Examples:
+ | ${str} = | Set Variable | Robot Framework | | |
+ | ${str} = | Remove From String | ${str} | work | |
+ | Should Be Equal | ${str} | Robot Frame | | |
+ | ${str} = | Set Variable | Robot Framework | | |
+ | ${str} = | Remove From String | ${str} | o | wrk |
+ | Should Be Equal | ${str} | Rbt Frame | | |
+
+ New in Robot Framework 2.8.2
+ """
+
+ for removable in removables:
+ string = self.replace_string(string, removable, '')
+ return string
+
+ def remove_string_using_regexp(self, string, *patterns):
+ """Removes `patterns` from the given `string`.
+
+ This keyword is otherwise identical to `Remove String`, but
+ the `patterns` to search for are considered to be a regular
+ expression. See `BuiltIn.Should Match Regexp` for more
+ information about Python regular expression syntax in general
+ and how to use it in Robot Framework test data in particular.
+
+ Examples:
+ | ${str} = | Set Variable | Robot Framework | | |
+ | ${str} = | Remove String Using Regexp | ${str} | w.*k | |
+ | Should Be Equal | ${str} | Robot Frame | | |
+ | ${str} = | Set Variable | Robot Framework | | |
+ | ${str} = | Remove String Using Regexp | ${str} | b.t | w.*k |
+ | Should Be Equal | ${str} | Ro Frame | | |
+
+ New in Robot Framework 2.8.2
+ """
+ for pattern in patterns:
+ string = self.replace_string_using_regexp(string, pattern, '')
+ return string
+
def split_string(self, string, separator=None, max_split=-1):
"""Splits the `string` using `separator` as a delimiter string.
@@ -501,59 +554,6 @@
if not string.istitle():
self._fail(msg, "'%s' is not titlecase.", string)
- def remove_string(self, string, *removables):
- """Removes `removables` in the given `string`.
-
- `removables` are used as literal strings. Each removable will be
- matched to a temporary string from which preceding removables have
- been already removed. See second example below.
-
- See `Remove String Using Regexp` if more powerful pattern matching
is needed.
-
- If you need to remove a certain number of matches use `Replace
String` to
- replace certain count with empty string.
-
- A modified version of the string is returned and the original
- string is not altered.
-
- Examples:
- | ${str} = | Set Variable | Robot Framework | | |
- | ${str} = | Remove From String | ${str} | work | |
- | Should Be Equal | ${str} | Robot Frame | | |
- | ${str} = | Set Variable | Robot Framework | | |
- | ${str} = | Remove From String | ${str} | o | wrk |
- | Should Be Equal | ${str} | Rbt Frame | | |
-
- New in Robot Framework 2.8.2
- """
-
- for removable in removables:
- string = self.replace_string(string, removable, '')
- return string
-
- def remove_string_using_regexp(self, string, *patterns):
- """Removes `patterns` from the given `string`.
-
- This keyword is otherwise identical to `Remove String`, but
- the `patterns` to search for are considered to be a regular
- expression. See `BuiltIn.Should Match Regexp` for more
- information about Python regular expression syntax in general
- and how to use it in Robot Framework test data in particular.
-
- Examples:
- | ${str} = | Set Variable | Robot Framework | | |
- | ${str} = | Remove String Using Regexp | ${str} | w.*k | |
- | Should Be Equal | ${str} | Robot Frame | | |
- | ${str} = | Set Variable | Robot Framework | | |
- | ${str} = | Remove String Using Regexp | ${str} | b.t | w.*k |
- | Should Be Equal | ${str} | Ro Frame | | |
-
- New in Robot Framework 2.8.2
- """
- for pattern in patterns:
- string = self.replace_string_using_regexp(string, pattern, '')
- return string
-
def _convert_to_index(self, value, name):
if value == '':
return 0
==============================================================================
Revision: 61b9f1961f70
Branch: default
Author: Robot Framework Developers (robotframew...@gmail.com)
Date: Thu Oct 3 12:41:20 2013 UTC
Log: String: Enhance docs of Replace/Remove String (Using Regexp).
Update issue 1491
Cc: pekka.klarck
Status: Done
Enhanced docs. Consider done.
http://code.google.com/p/robotframework/source/detail?r=61b9f1961f70
Modified:
/src/robot/libraries/String.py
=======================================
--- /src/robot/libraries/String.py Thu Oct 3 12:01:12 2013 UTC
+++ /src/robot/libraries/String.py Thu Oct 3 12:41:20 2013 UTC
@@ -234,7 +234,6 @@
`search_for` is used as a literal string. See `Replace String
Using Regexp` if more powerful pattern matching is needed.
-
If you need to just remove a string see `Remove String`.
If the optional argument `count` is given, only that many
@@ -246,16 +245,10 @@
string is not altered.
Examples:
- | ${str} = | Set Variable | Hello, world! | | | |
- | ${str} = | Replace String | ${str} | Hello | Hi | |
- | Should Be Equal | ${str} | Hi, world! | | | |
- | ${str} = | Set Variable | Hello, world! | | | |
- | ${str} = | Replace String | ${str} | o | oes | 1 |
- | Should Be Equal | ${str} | Helloes, world! | | | |
- | ${str} = | Set Variable | Hello, world! | | | |
- | ${str} = | Replace String | ${str} | l | ${EMPTY} | 2 |
- | Should Be Equal | ${str} | Heo world! | | | |
-
+ | ${str} = | Replace String | Hello, world! | world |
tellus |
+ | Should Be Equal | ${str} | Hello, tellus! |
| |
+ | ${str} = | Replace String | Hello, world! | l |
${EMPTY} | count=1 |
+ | Should Be Equal | ${str} | Helo, world! |
| |
"""
count = self._convert_to_integer(count, 'count')
return string.replace(search_for, replace_with, count)
@@ -263,21 +256,17 @@
def replace_string_using_regexp(self, string, pattern, replace_with,
count=-1):
"""Replaces `pattern` in the given `string` with `replace_with`.
- If you need to just remove a string see `Remove String Using
Regexp`.
-
This keyword is otherwise identical to `Replace String`, but
the `pattern` to search for is considered to be a regular
expression. See `BuiltIn.Should Match Regexp` for more
information about Python regular expression syntax in general
and how to use it in Robot Framework test data in particular.
+ If you need to just remove a string see `Remove String Using
Regexp`.
+
Examples:
- | ${str} = | Set Variable | Hello, world! Hi, world! | | | |
- | ${str} = | Replace String Using Regexp | ${str} | (Hello|Hi) |
Hei | |
- | Should Be Equal | ${str} | Hei, world! Hei, world! | | | |
- | ${str} = | Set Variable | Today is 2013-10-02. Tomorrow is
2013-10-03 | | | |
- | ${str} = | Replace String Using Regexp | ${str} |
20\\\\d\\\\d-\\\\d\\\\d-\\\\d\\\\d | <DATE> | 1 |
- | Should Be Equal | ${str} | Today is <DATE>. Tomorrow is
2013-10-03 | | | |
+ | ${str} = | Replace String Using Regexp | ${str} |
20\\\\d\\\\d-\\\\d\\\\d-\\\\d\\\\d | <DATE> |
+ | ${str} = | Replace String Using Regexp | ${str} | (Hello|Hi) |
${EMPTY} | count=1 |
"""
count = self._convert_to_integer(count, 'count')
# re.sub handles 0 and negative counts differently than
string.replace
@@ -286,31 +275,27 @@
return re.sub(pattern, replace_with, string, max(count, 0))
def remove_string(self, string, *removables):
- """Removes `removables` in the given `string`.
+ """Removes all `removables` from the given `string`.
`removables` are used as literal strings. Each removable will be
matched to a temporary string from which preceding removables have
been already removed. See second example below.
- See `Remove String Using Regexp` if more powerful pattern matching
is needed.
-
- If you need to remove a certain number of matches use `Replace
String` to
- replace certain count with empty string.
+ Use `Remove String Using Regexp` if more powerful pattern matching
is
+ needed. If only a certain number of matches should be removed,
+ `Replace String` or `Replace String Using Regexp` can be used.
A modified version of the string is returned and the original
string is not altered.
Examples:
- | ${str} = | Set Variable | Robot Framework | | |
- | ${str} = | Remove From String | ${str} | work | |
- | Should Be Equal | ${str} | Robot Frame | | |
- | ${str} = | Set Variable | Robot Framework | | |
- | ${str} = | Remove From String | ${str} | o | wrk |
- | Should Be Equal | ${str} | Rbt Frame | | |
+ | ${str} = | Remove From String | Robot Framework | work |
+ | Should Be Equal | ${str} | Robot Frame |
+ | ${str} = | Remove From String | Robot Framework | o | bt |
+ | Should Be Equal | ${str} | R Framewrk |
- New in Robot Framework 2.8.2
+ New in Robot Framework 2.8.2.
"""
-
for removable in removables:
string = self.replace_string(string, removable, '')
return string
@@ -320,17 +305,10 @@
This keyword is otherwise identical to `Remove String`, but
the `patterns` to search for are considered to be a regular
- expression. See `BuiltIn.Should Match Regexp` for more
- information about Python regular expression syntax in general
- and how to use it in Robot Framework test data in particular.
-
- Examples:
- | ${str} = | Set Variable | Robot Framework | | |
- | ${str} = | Remove String Using Regexp | ${str} | w.*k | |
- | Should Be Equal | ${str} | Robot Frame | | |
- | ${str} = | Set Variable | Robot Framework | | |
- | ${str} = | Remove String Using Regexp | ${str} | b.t | w.*k |
- | Should Be Equal | ${str} | Ro Frame | | |
+ expression. See `Replace String Using Regexp` for more information
+ about the regular expression syntax. That keyword can also be
+ used if there is a need to remove only a certain number of
+ occurrences.
New in Robot Framework 2.8.2
"""
--
---
You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.