Revision: 2503
Author: janne.t.harkonen
Date: Mon Feb 22 23:24:54 2010
Log: whitespace
http://code.google.com/p/robotframework/source/detail?r=2503

Modified:
 /trunk/src/robot/libraries/BuiltIn.py

=======================================
--- /trunk/src/robot/libraries/BuiltIn.py       Mon Feb  1 14:29:40 2010
+++ /trunk/src/robot/libraries/BuiltIn.py       Mon Feb 22 23:24:54 2010
@@ -30,7 +30,7 @@


 class _Converter:
-
+
     def convert_to_integer(self, item):
         """Converts the given item to an integer number."""
         try:
@@ -87,10 +87,10 @@
         'toString' with Java objects.
         """
         return utils.unic(item)
-
+
     def convert_to_boolean(self, item):
         """Converts the given item to Boolean true or false.
-
+
         Handles strings 'True' and 'False' (case-insensitive) as expected,
         otherwise returns item's truth value using Python's 'bool' method.
         For more information about truth values, see
@@ -105,7 +105,7 @@

     def create_list(self, *items):
         """Returns a list containing given items.
-
+
         The returned list can be assigned both to ${scalar} and @{list}
variables. The earlier can be used e.g. with Java keywords expecting
         an array as an argument.
@@ -128,7 +128,7 @@

     def should_not_be_true(self, condition, msg=None):
         """Fails if the given condition is true.
-
+
See `Should Be True` for details about how `condition` is evaluated and
         how `msg` can be used to override the default error message.
         """
@@ -138,21 +138,21 @@

     def should_be_true(self, condition, msg=None):
         """Fails if the given condition is not true.
-
- If `condition` is a string (e.g. '${rc} < 10'), it is evaluated as a - Python expression using the built-in 'eval' function and the keyword - status is decided based on the result. If a non-string item is given,
+
+ If `condition` is a string (e.g. '${rc} < 10'), it is evaluated as a + Python expression using the built-in 'eval' function and the keyword + status is decided based on the result. If a non-string item is given,
         the status is got directly from its truth value as explained at
         http://docs.python.org/lib/truth.html.
-
+
The default error message ('<condition> should be true') is not very
         informative, but it can be overridden with the `msg` argument.
-
+
         Examples:
-        | Should Be True | ${rc} < 10  |
+        | Should Be True | ${rc} < 10  |
| Should Be True | '${status}' == 'PASS' | # Strings must be quoted | | Should Be True | ${number} | # Passes if ${number} is not zero | - | Should Be True | ${list} | # Passes if ${list} is not empty | + | Should Be True | ${list} | # Passes if ${list} is not empty |
         """
         if msg is None:
             msg = "'%s' should be true" % condition
@@ -160,7 +160,7 @@

     def should_be_equal(self, first, second, msg=None, values=True):
         """Fails if the given objects are unequal.
-
+
         - If `msg` is not given, the error message is 'first != second'.
         - If `msg` is given and `values` is either Boolean False or the
           string 'False' or 'No Values', the error message is simply `msg`.
@@ -171,7 +171,7 @@

     def should_not_be_equal(self, first, second, msg=None, values=True):
         """Fails if the given objects are equal.
-
+
See `Should Be Equal` for an explanation on how to override the default
         error message with `msg` and `values`.
         """
@@ -180,7 +180,7 @@

def should_not_be_equal_as_integers(self, first, second, msg=None, values=True):
         """Fails if objects are equal after converting them to integers.
-
+
See `Should Be Equal` for an explanation on how to override the default
         error message with `msg` and `values`.
         """
@@ -198,12 +198,12 @@

def should_not_be_equal_as_numbers(self, first, second, msg=None, values=True): """Fails if objects are equal after converting them to real numbers.
-
+
         Starting from Robot Framework 2.0.2, the check for equality is
         done using six decimal places.

See `Should Be Equal` for an explanation on how to override the default
-        error message with `msg` and `values`.
+        error message with `msg` and `values`.
         """
         first = round(self.convert_to_number(first), 6)
         second = round(self.convert_to_number(second), 6)
@@ -221,19 +221,19 @@
         first = round(self.convert_to_number(first), 6)
         second = round(self.convert_to_number(second), 6)
         self.should_be_equal(first, second, msg, values)
-
+
def should_not_be_equal_as_strings(self, first, second, msg=None, values=True):
         """Fails if objects are equal after converting them to strings.
-
+
See `Should Be Equal` for an explanation on how to override the default
         error message with `msg` and `values`.
         """
first, second = [ self.convert_to_string(i) for i in first, second ]
         self.should_not_be_equal(first, second, msg, values)
-
+
def should_be_equal_as_strings(self, first, second, msg=None, values=True):
         """Fails if objects are unequal after converting them to strings.
-
+
See `Should Be Equal` for an explanation on how to override the default
         error message with `msg` and `values`.
         """
@@ -242,7 +242,7 @@

     def should_not_start_with(self, str1, str2, msg=None, values=True):
         """Fails if the string `str1` starts with the string `str2`.
-
+
See `Should Be Equal` for an explanation on how to override the default
         error message with `msg` and `values`.
         """
@@ -251,7 +251,7 @@

     def should_start_with(self, str1, str2, msg=None, values=True):
"""Fails if the string `str1` does not start with the string `str2`.
-
+
See `Should Be Equal` for an explanation on how to override the default
         error message with `msg` and `values`.
         """
@@ -260,7 +260,7 @@

     def should_not_end_with(self, str1, str2, msg=None, values=True):
         """Fails if the string `str1` ends with the string `str2`.
-
+
See `Should Be Equal` for an explanation on how to override the default
         error message with `msg` and `values`.
         """
@@ -271,7 +271,7 @@
         """Fails if the string `str1` does not end with the string `str2`.

See `Should Be Equal` for an explanation on how to override the default
-        error message with `msg` and `values`.
+        error message with `msg` and `values`.
         """
msg = self._get_string_msg(str1, str2, msg, values, 'does not end with')
         asserts.fail_unless(str1.endswith(str2), msg)
@@ -292,7 +292,7 @@

     def should_contain(self, item1, item2, msg=None, values=True):
         """Fails if `item1` does not contain `item2` one or more times.
-
+
         Works with strings, lists, and anything that supports Python's 'in'
keyword. See `Should Be Equal` for an explanation on how to override
         the default error message with `msg` and `values`.
@@ -306,7 +306,7 @@

     def should_contain_x_times(self, item1, item2, count, msg=None):
         """Fails if `item1` does not contain `item2` `count` times.
-
+
         Works with strings, lists and all objects that `Get Count` works
         with. The default error message can be overridden with `msg` and
         the actual count is always logged.
@@ -319,7 +319,7 @@
msg = "'%s' does not contain '%s' %s times" % (item1, item2, count)
         self.should_be_equal_as_integers(self.get_count(item1, item2),
                                          count, msg, values=False)
-
+
     def get_count(self, item1, item2):
         """Returns and logs how many times `item2` is found from `item1`.

@@ -334,7 +334,7 @@
             try:
                 item1 = list(item1)
             except:
-                raise DataError("Converting '%s' to list failed: %s"
+                raise DataError("Converting '%s' to list failed: %s"
                                 % (item1, utils.get_error_message()))
         count = item1.count(item2)
         self.log('Item found from the first item %d time%s'
@@ -346,8 +346,8 @@

         Pattern matching is similar as matching files in a shell, and it is
always case-sensitive. In the pattern '*' matches to anything and '?'
-        matches to any single character.
-
+        matches to any single character.
+
See `Should Be Equal` for an explanation on how to override the default
         error message with `msg` and `values`.
         """
@@ -359,8 +359,8 @@

         Pattern matching is similar as matching files in a shell, and it is
always case-sensitive. In the pattern, '*' matches to anything and '?'
-        matches to any single character.
-
+        matches to any single character.
+
See `Should Be Equal` for an explanation on how to override the default
         error message with `msg` and `values`.
         """
@@ -375,7 +375,7 @@
has a pattern syntax derived from Perl, and thus also very similar to
         the one in Java. See the following documents for more details about
regular expressions in general and Python implementation in particular.
-
+
         * http://docs.python.org/lib/module-re.html
         * http://www.amk.ca/python/howto/regex/

@@ -384,7 +384,7 @@
         1) Backslash is an escape character in the test data, and possible
backslashes in the pattern must thus be escaped with another backslash
         (e.g. '\\\\d\\\\w+').
-
+
2) Strings that may contain special characters, but should be handled as literal strings, can be escaped with the `Regexp Escape` keyword.

@@ -398,15 +398,15 @@
re.IGNORECASE, re.MULTILINE) can be set by prefixing the pattern with the '(?iLmsux)' group (e.g. '(?im)pattern'). The available flags are
         'IGNORECASE': 'i', 'MULTILINE': 'm', 'DOTALL': 's', 'VERBOSE': 'x',
-        'UNICODE': 'u', and 'LOCALE': 'L'.
-
+        'UNICODE': 'u', and 'LOCALE': 'L'.
+
         If this keyword passes, it returns the portion of the string that
         matched the pattern. Additionally, the possible captured groups are
-        returned.
-
+        returned.
+
See the `Should Be Equal` keyword for an explanation on how to override
         the default error message with the `msg` and `values` arguments.
-
+
         Examples:
| Should Match Regexp | ${output} | \\\\d{6} | # Output contains six numbers | | Should Match Regexp | ${output} | ^\\\\d{6}$ | # Six numbers and nothing more |
@@ -418,7 +418,7 @@
         - ${match} = 'Bar: 43'
         - ${group1} = 'Bar'
         - ${group2} = '43'
-        """
+        """
         msg = self._get_string_msg(string, pattern, msg, values,
                                    'does not match')
         res = re.search(pattern, string)
@@ -428,18 +428,18 @@
         if groups:
             return [match] + list(groups)
         return match
-
+
def should_not_match_regexp(self, string, pattern, msg=None, values=True):
         """Fails if `string` matches `pattern` as a regular expression.
-
+
         See `Should Match Regexp` for more information about arguments.
         """
         msg = self._get_string_msg(string, pattern, msg, values, 'matches')
         asserts.fail_unless_none(re.search(pattern, string), msg, False)
-
+
     def get_length(self, item):
         """Returns and logs the length of the given item.
-
+
         The keyword first tries to get the length with the Python function
         'len', which calls the item's '__len__' method internally. If that
fails, the keyword tries to call the item's 'length' and 'size' methods
@@ -465,10 +465,10 @@
                     except (KeyboardInterrupt, SystemExit): raise
                     except:
raise DataError("Could not get length of '%s'" % item)
-
+
     def length_should_be(self, item, length, msg=None):
         """Verifies that the length of the given item is correct.
-
+
         The length of the item is got using the `Get Length` keyword. The
         default error message can be overridden with the `msg` argument.
         """
@@ -482,10 +482,10 @@
                 msg = "Length of '%s' should be %d but it is %d" \
                         % (item, length, self.get_length(item))
             raise AssertionError(msg)
-
+
     def should_be_empty(self, item, msg=None):
         """Verifies that the given item is empty.
-
+
         The length of the item is got using the `Get Length` keyword. The
         default error message can be overridden with the `msg` argument.
         """
@@ -493,10 +493,10 @@
             if msg is None:
                 msg = "'%s' should be empty" % item
             raise AssertionError(msg)
-
+
     def should_not_be_empty(self, item, msg=None):
         """Verifies that the given item is not empty.
-
+
         The length of the item is got using the `Get Length` keyword. The
         default error message can be overridden with the `msg` argument.
         """
@@ -513,9 +513,9 @@
             msg = '%s: %s' % (msg, _msg)
         return msg

-
+
 class _Variables:
-
+
     def log_variables(self, level='INFO'):
         """Logs all variables in the current scope with given log level."""
         variables = self._get_variables()
@@ -531,12 +531,12 @@

     def variable_should_exist(self, name, msg=None):
         """Fails unless the given variable exists within the current scope.
-
+
The name of the variable can be given either as a normal variable name (e.g. ${NAME}) or in escaped format (e.g. \\${NAME}). Notice that the
-        former works only in Robot Framework 2.1 and newer, and it has some
+        former works only in Robot Framework 2.1 and newer, and it has some
         limitations explained in `Set Suite Variable`.
-
+
The default error message can be overridden with the `msg` argument.
         """
         name = self._get_var_name(name)
@@ -546,15 +546,15 @@
         else:
             msg = "Variable %s does not exist" % name
         asserts.fail_unless(variables.has_key(name), msg)
-
+
     def variable_should_not_exist(self, name, msg=None):
         """Fails if the given variable exists within the current scope.
-
+
The name of the variable can be given either as a normal variable name (e.g. ${NAME}) or in escaped format (e.g. \\${NAME}). Notice that the
-        former works only in Robot Framework 2.1 and newer, and it has some
+        former works only in Robot Framework 2.1 and newer, and it has some
         limitations explained in `Set Suite Variable`.
-
+
The default error message can be overridden with the `msg` argument.
         """
         name = self._get_var_name(name)
@@ -567,14 +567,14 @@

     def replace_variables(self, text):
         """Replaces variables in the given text with their current values.
-
+
         If the text contains undefined variables, this keyword fails.
-
+
         Example:

         The file 'template.txt' contains 'Hello ${NAME}!' and variable
         '${NAME}' has the value 'Robot'.
-
+
         | ${template} =   | Get File          | ${CURDIR}/template.txt |
         | ${message} =    | Replace Variables | ${template}            |
         | Should Be Equal | ${message}        | Hello Robot!           |
@@ -584,7 +584,7 @@
         earlier, this keyword returns a string.
         """
         return self._get_variables().replace_scalar(text)
-
+
     def set_variable(self, *values):
"""Returns the given values which can then be assigned to a variables.

@@ -599,7 +599,7 @@
         | ${var1}   | ${var2} =    | Set Variable | Hello | world |
         | @{list} = | Set Variable | ${list with some items} |
         | ${item1}  | ${item2} =   | Set Variable  | ${list with 2 items} |
-
+
         Variables created with this keyword are available only in the
         scope where they are created. See `Set Global Variable`, `Set
         Test Variable` and `Set Suite Variable` for information on how to
@@ -614,49 +614,49 @@

     def set_test_variable(self, name, *values):
"""Makes a variable available everywhere within the scope of the current test.
-
+
         Variables set with this keyword are available everywhere within the
scope of the currently executed test case. For example, if you set a variable in a user keyword, it is available both in the test case level
         and also in all other user keywords used in the current test. Other
         test cases will not see variables set with this keyword.
-
+
         See `Set Suite Variable` for more information and examples.
         """
         name = self._get_var_name(name)
         value = self._get_var_value(name, values)
         self._get_variables().set_test(name, value)
         self._log_set_variable(name, value)
-
+
     def set_suite_variable(self, name, *values):
"""Makes a variable available everywhere within the scope of the current suite.
-
+
         Variables set with this keyword are available everywhere within the
scope of the currently executed test suite. Setting variables with this keyword thus has the same effect as creating them using the Variable
         table in the test data file or importing them from variable files.
Other test suites, including possible child test suites, will not see
-        variables set with this keyword.
-
+        variables set with this keyword.
+
The name of the variable can be given either as a normal variable name (e.g. ${NAME}) or in escaped format (e.g. \\${NAME}). Notice that the
         former works only in Robot Framework 2.1 and newer.
-
+
If a variable already exists within the new scope, its value will be overwritten. Otherwise a new variable is created. If a variable already exists within the current scope, the value can be left empty and the variable within the new scope gets the value within the current scope.

         Examples:
-        | Set Suite Variable | ${GREET} | Hello, world! |
+        | Set Suite Variable | ${GREET} | Hello, world! |
         | ${ID} =            | Get ID   |
         | Set Suite Variable | ${ID}    |

*NOTE:* If the variable has value which itself is a variable (escaped
-        or not), you must always use the escaped format like in the example
+        or not), you must always use the escaped format like in the example
         below. This limitation applies to `Set Test/Suite/Global Variable`
         and `Variable Should (Not) Exist` keywords.
-
+
         Example:
         | ${NAME} =          | Set Variable | \${variable} |
| Set Suite Variable | ${NAME} | new value | # Does not work |
@@ -666,25 +666,25 @@
         value = self._get_var_value(name, values)
         self._get_variables().set_suite(name, value)
         self._log_set_variable(name, value)
-
+
     def set_global_variable(self, name, *values):
         """Makes a variable available globally in all tests and suites.
-
+
         Variables set with this keyword are globally available in all test
cases and suites executed after setting them. Setting variables with this keyword thus has the same effect as creating from the command line
         using the options '--variable' or '--variablefile'. Because this
keyword can change variables everywhere, it should be used with care.
-
+
         See `Set Suite Variable` for more information and examples.
         """
         name = self._get_var_name(name)
         value = self._get_var_value(name, values)
         self._get_variables().set_global(name, value)
         self._log_set_variable(name, value)
-
+
     # Helpers
-
+
     def _get_variables(self):
         return NAMESPACES.current.variables

@@ -701,7 +701,7 @@
             return self._unescape_variable_if_needed(resolved)
         except (KeyError, ValueError, DataError):
             return name
-
+
     def _unescape_variable_if_needed(self, name):
         if not (utils.is_str(name) and len(name) > 1):
             raise ValueError
@@ -716,7 +716,7 @@
         if is_var(name):
             return name
         raise ValueError
-
+
     def _get_var_value(self, name, values):
         variables = self._get_variables()
         if not values:
@@ -739,12 +739,12 @@
# If you use any of these run keyword variants from another library, you # should register those keywords with 'register_run_keyword' method. See # the documentation of that method at the end of this file. There are also
-    # other run keyword variant keywords in BuiltIn which can also be seen
+    # other run keyword variant keywords in BuiltIn which can also be seen
     # at the end of this file.
-
+
     def run_keyword(self, name, *args):
         """Executes the given keyword with the given arguments.
-
+
Because the name of the keyword to execute is given as an argument, it can be a variable and thus set dynamically, e.g. from a return value of
         another keyword or from the command line.
@@ -753,25 +753,25 @@
             raise DataError('Keyword name must be a string')
         kw = Keyword(name, args)
         return kw.run(output.OUTPUT, NAMESPACES.current)
-
+
     def run_keyword_if(self, condition, name, *args):
"""Runs the given keyword with the given arguments, if `condition` is true.
-
+
         The given `condition` is evaluated similarly as with `Should Be
         True` keyword, and `name` and `*args` have same semantics as with
         `Run Keyword`.
-
+
         Example, a simple if/else construct:
| ${status} | ${value} = | Run Keyword And Ignore Error | My Keyword |
         | Run Keyword If     | '${status}' == 'PASS' | Some Action    |
         | Run Keyword Unless | '${status}' == 'PASS' | Another Action |
-
+
         In this example, only either 'Some Action' or 'Another Action' is
         executed, based on the status of 'My Keyword'.
         """
         if self._is_true(condition):
             return self.run_keyword(name, *args)
-
+
     def run_keyword_unless(self, condition, name, *args):
"""Runs the given keyword with the given arguments, if `condition` is false.

@@ -779,15 +779,15 @@
         """
         if not self._is_true(condition):
             return self.run_keyword(name, *args)
-
+
     def run_keyword_and_ignore_error(self, name, *args):
"""Runs the given keyword with the given arguments and ignores possible error.
-
+
This keyword returns two values, so that the first is either 'PASS' or
         'FAIL', depending on the status of the executed keyword. The second
value is either the return value of the keyword or the received error
         message.
-
+
         The keyword name and arguments work as in `Run Keyword`. See
         `Run Keyword If` for a usage example.
         """
@@ -795,24 +795,24 @@
             return 'PASS', self.run_keyword(name, *args)
         except:
             return 'FAIL', utils.get_error_message()
-
+
     def run_keyword_and_expect_error(self, expected_error, name, *args):
         """Runs the keyword and checks that the expected error occurred.
-
+
         The expected error must be given in the same format as in
         Robot Framework reports. It can be a pattern containing
         characters '?', which matches to any single character and
         '*', which matches to any number of any characters. `name` and
         `*args` have same semantics as with `Run Keyword`.
-
+
If the expected error occurs, the error message is returned and it can - be further processed/tested, if needed. If there is no error, or the + be further processed/tested, if needed. If there is no error, or the
         error does not match the expected error, this keyword fails.
-
+
         Examples:
| Run Keyword And Expect Error | My error | Some Keyword | arg1 | arg2 |
-        | ${msg} = | Run Keyword And Expect Error | * | My KW |
-        | Should Start With | ${msg} | Once upon a time in |
+        | ${msg} = | Run Keyword And Expect Error | * | My KW |
+        | Should Start With | ${msg} | Once upon a time in |
         """
         try:
             self.run_keyword(name, *args)
@@ -822,7 +822,7 @@
             raise AssertionError("Expected error '%s' did not occur"
                                  % expected_error)
         if not self._matches(error, expected_error):
-            raise AssertionError("Expected error '%s' but got '%s'"
+            raise AssertionError("Expected error '%s' but got '%s'"
                                  % (expected_error, error))
         return error

@@ -855,19 +855,19 @@
         for i in xrange(times):
             self.log("Repeating keyword, round %d/%d" % (i+1, times))
             self.run_keyword(name, *args)
-
+
def wait_until_keyword_succeeds(self, timeout, retry_interval, name, *args): """Waits until the specified keyword succeeds or the given timeout expires.
-
+
         `name` and `args` define the keyword that is executed
         similarly as with `Run Keyword`. If the specified keyword does
         not succeed within `timeout`, this keyword fails.
         `retry_interval` is the time to wait before trying to run the
         keyword again after the previous run has failed.
-
+
Both `timeout` and `retry_interval` must be given in Robot Framework's
         time format (e.g. '1 minute', '2 min 3 s', '4.5').
-
+
         Example:
| Wait Until Keyword Succeeds | 2 min | 5 sec | My keyword | arg1 | arg2 |
         """
@@ -887,7 +887,7 @@
                     time.sleep(retry_interval)
         raise AssertionError("Timeout %s exceeded. The last error was: %s"
                              % (utils.secs_to_timestr(timeout), error))
-
+
     def set_variable_if(self, condition, *values):
         """Sets variable based on the given condition.

@@ -898,11 +898,11 @@
         returned. The second value can also be omitted, in which case
         it has a default value None. This usage is illustrated in the
         examples below, where ${rc} is assumed to be zero.
-
-        | ${var1} = | Set Variable If | ${rc} == 0 | zero     | nonzero |
+
+        | ${var1} = | Set Variable If | ${rc} == 0 | zero     | nonzero |
         | ${var2} = | Set Variable If | ${rc} > 0  | value1   | value2  |
         | ${var3} = | Set Variable If | ${rc} > 0  | whatever |         |
-        =>
+        =>
         - ${var1} = 'zero'
         - ${var2} = 'value2'
         - ${var3} = None
@@ -914,15 +914,15 @@
         values after it is returned based on its truth value. This can
         be continued by adding more conditions without a limit.

-        | ${var} = | Set Variable If | ${rc} == 0        | zero           |
+        | ${var} = | Set Variable If | ${rc} == 0        | zero           |
         | ...      | ${rc} > 0       | greater than zero | less then zero |
         |          |
-        | ${var} = | Set Variable If |
-        | ...      | ${rc} == 0      | zero              |
-        | ...      | ${rc} == 1      | one               |
-        | ...      | ${rc} == 2      | two               |
-        | ...      | ${rc} > 2       | greater than two  |
-        | ...      | ${rc} < 0       | less than zero    |
+        | ${var} = | Set Variable If |
+        | ...      | ${rc} == 0      | zero              |
+        | ...      | ${rc} == 1      | one               |
+        | ...      | ${rc} == 2      | two               |
+        | ...      | ${rc} > 2       | greater than two  |
+        | ...      | ${rc} < 0       | less than zero    |
         """
         values = self._verify_values_for_set_variable_if(list(values))
         if self._is_true(condition):
@@ -945,85 +945,85 @@

     def run_keyword_if_test_failed(self, name, *args):
"""Runs the given keyword with the given arguments, if the test failed.
-
+
         This keyword can only be used in a test teardown. Trying to use it
         anywhere else results in an error.
-
-        Otherwise, this keyword works exactly like `Run Keyword`, see its
-        documentation for more details.
+
+        Otherwise, this keyword works exactly like `Run Keyword`, see its
+        documentation for more details.
         """
         test = self._get_test_in_teardown('Run Keyword If Test Failed')
         if test.status == 'FAIL':
             return self.run_keyword(name, *args)
-
+
     def run_keyword_if_test_passed(self, name, *args):
"""Runs the given keyword with the given arguments, if the test passed.
-
+
         This keyword can only be used in a test teardown. Trying to use it
         anywhere else results in an error.
-
-        Otherwise, this keyword works exactly like `Run Keyword`, see its
-        documentation for more details.
+
+        Otherwise, this keyword works exactly like `Run Keyword`, see its
+        documentation for more details.
         """
         test = self._get_test_in_teardown('Run Keyword If Test Passed')
         if test.status == 'PASS':
             return self.run_keyword(name, *args)
-
+
     def _get_test_in_teardown(self, kwname):
         test = NAMESPACES.current.test
         if test is not None and test.status != 'RUNNING':
             return test
-        raise DataError("Keyword '%s' can only be used in test teardown"
+        raise DataError("Keyword '%s' can only be used in test teardown"
                         % kwname)
-
+
     def run_keyword_if_all_critical_tests_passed(self, name, *args):
"""Runs the given keyword with the given arguments, if all critical tests passed.
-
+
This keyword can only be used in suite teardown. Trying to use it in
         any other place will result in an error.
-
-        Otherwise, this keyword works exactly like `Run Keyword`, see its
-        documentation for more details.
+
+        Otherwise, this keyword works exactly like `Run Keyword`, see its
+        documentation for more details.
         """
         suite = self._get_suite_in_teardown('Run Keyword If '
                                             'All Critical Tests Passed')
         if suite.critical_stats.failed == 0:
             return self.run_keyword(name, *args)
-
+
     def run_keyword_if_any_critical_tests_failed(self, name, *args):
"""Runs the given keyword with the given arguments, if any critical tests failed.
-
+
         This keyword can only be used in a suite teardown. Trying to use it
         anywhere else results in an error.
-
-        Otherwise, this keyword works exactly like `Run Keyword`, see its
-        documentation for more details.
+
+        Otherwise, this keyword works exactly like `Run Keyword`, see its
+        documentation for more details.
         """
         suite = self._get_suite_in_teardown('Run Keyword If '
                                             'Any Critical Tests Failed')
         if suite.critical_stats.failed > 0:
             return self.run_keyword(name, *args)
-
+
     def run_keyword_if_all_tests_passed(self, name, *args):
"""Runs the given keyword with the given arguments, if all tests passed.
-
+
         This keyword can only be used in a suite teardown. Trying to use it
         anywhere else results in an error.
-
-        Otherwise, this keyword works exactly like `Run Keyword`, see its
-        documentation for more details.
+
+        Otherwise, this keyword works exactly like `Run Keyword`, see its
+        documentation for more details.
         """
suite = self._get_suite_in_teardown('Run Keyword If All Tests Passed')
         if suite.all_stats.failed == 0:
             return self.run_keyword(name, *args)
-
+
     def run_keyword_if_any_tests_failed(self, name, *args):
"""Runs the given keyword with the given arguments, if one or more tests failed.
-
+
         This keyword can only be used in a suite teardown. Trying to use it
         anywhere else results in an error.
-
-        Otherwise, this keyword works exactly like `Run Keyword`, see its
+
+        Otherwise, this keyword works exactly like `Run Keyword`, see its
         documentation for more details.
         """
suite = self._get_suite_in_teardown('Run Keyword If Any Tests Failed')
@@ -1032,23 +1032,23 @@

     def _get_suite_in_teardown(self, kwname):
         if NAMESPACES.current.suite.status == 'RUNNING':
- raise DataError("Keyword '%s' can only be used in suite teardown" + raise DataError("Keyword '%s' can only be used in suite teardown"
                             % kwname)
         return NAMESPACES.current.suite


 class _Misc:
-
+
     def no_operation(self):
         """Does absolutely nothing."""

     def sleep(self, time_, reason=None):
         """Pauses the test executed for the given time.
-
+
         `time` may be either a number or a time string. Time strings are in
a format such as '1 day 2 hours 3 minutes 4 seconds 5milliseconds' or '1d 2h 3m 4s 5ms', and they are fully explained in an appendix of Robot
-        Framework User Guide. Optional `reason` can be used to explain why
+        Framework User Guide. Optional `reason` can be used to explain why
sleeping is necessary. Both the time slept and the reason are logged.

         Examples:
@@ -1068,11 +1068,11 @@

     def catenate(self, *items):
"""Catenates the given items together and returns the resulted string.
-
-        By default, items are catenated with spaces, but if the first item
+
+        By default, items are catenated with spaces, but if the first item
contains the string 'SEPARATOR=<sep>', the separator '<sep>' is used.
         Items are converted into strings when necessary.
-
+
         Examples:
         | ${str1} = | Catenate | Hello         | world |       |
         | ${str2} = | Catenate | SEPARATOR=--- | Hello | world |
@@ -1121,36 +1121,36 @@

     def comment(self, *messages):
"""Displays the given messages in the log file as keyword arguments.
-
+
This keyword does nothing with the arguments it receives, but as they
         are visible in the log, this keyword can be used to display simple
- messages. Given arguments are ignored so thoroughly that they can even - contain non-existing variables. If you are interested about variable + messages. Given arguments are ignored so thoroughly that they can even + contain non-existing variables. If you are interested about variable
         values, you can use the `Log` or `Log Many` keywords.
         """
         pass

     def set_log_level(self, level):
"""Sets the log threshold to the specified level and returns the old level.
-
+
Messages below the level will not logged. The default logging level is
         INFO, but it can be overridden with the command line option
         '--loglevel'.
-
+
The available levels: TRACE, DEBUG, INFO (default), WARN and NONE (no
         logging).
         """
         old = output.OUTPUT.set_log_level(level)
         self.log('Log level changed from %s to %s' % (old, level.upper()))
         return old
-
+
     def syslog(self, message, level="INFO"):
"""*DEPRECATED* Use `Log` keyword with WARN level instead. This keyword will be removed in Robot Framework 2.2."""
         output.LOGGER.write(message, level)
-
+
     def import_library(self, name, *args):
         """Imports a library with the given name and optional arguments.
-
+
This functionality allows dynamic importing of libraries while tests are running. That may be necessary, if the library itself is dynamic and not yet available when test data is processed. In a normal case,
@@ -1171,31 +1171,31 @@
| Import Library | ${CURDIR}/../libs/Lib.java | arg | WITH NAME | JavaLib |
         """
         NAMESPACES.current.import_library(name.replace('/', os.sep), args)
-
+
     def import_variables(self, path, *args):
"""Imports a variable file with the given path and optional arguments.
-
+
Variables imported with this keyword are set into the test suite scope similarly when importing them in the Setting table using the Variables
         setting. These variables override possible existing variables with
the same names and this functionality can thus be used to import new
         variables, e.g. for each test in a test suite.
-
+
         The given path must be absolute. Starting from 2.0.2 version,
         forward slashes can be used as path separator regardless the
operating system, but on earlier versions ${/} variable must be used
         instead.
-
+
         Examples:
         | Import Variables | ${CURDIR}/variables.py   |      |      |
         | Import Variables | ${CURDIR}/../vars/env.py | arg1 | arg2 |
         """
         NAMESPACES.current.import_variables(path.replace('/', os.sep),
                                             args, overwrite=True)
-
+
     def set_library_search_order(self, *libraries):
"""Sets the resolution order to use when a name matches multiple keywords.
-
+
         The library search order is used to resolve conflicts when a
         keyword name in the test data matches multiple keywords. The
         first library containing the keyword is selected and that
@@ -1226,13 +1226,13 @@
         libraries = [ lib.replace(' ', '') for lib in libraries ]
         NAMESPACES.current.library_search_order = libraries
         return library_search_order
-
+
     def get_time(self, format='timestamp', time_='NOW'):
-        """Returns the given time in the requested format.
-
+        """Returns the given time in the requested format.
+
How time is returned is determined based on the given `format` string
         as follows. Note that all checks are case-insensitive.
-
+
         1) If `format` contains the word 'epoch', the time is returned
            in seconds after the UNIX epoch. The return value is always
            an integer.
@@ -1275,7 +1275,7 @@
         | ${yyyy}   | ${mm}    | ${dd} =     | Get Time | year,month,day |
         | @{time} = | Get Time | year month day hour min sec |  |  |
         | ${y}      | ${s} =   | Get Time    | seconds and year |  |
-        =>
+        =>
         - ${time} = '2006-03-29 15:06:21'
         - ${secs} = 1143637581
         - ${year} = '2006'
@@ -1283,13 +1283,13 @@
         - @{time} = ['2006', '03', '29', '15', '06', '21']
         - ${y} = '2006'
         - ${s} = '21'
-
+
         | ${time} = | Get Time |      | 1177654467 |
         | ${secs} = | Get Time | sec  | 2007-04-27 09:14:27 |
| ${year} = | Get Time | year | NOW | # The time of execution | | ${day} = | Get Time | day | NOW - 1d | # 1 day subtraced from NOW | | @{time} = | Get Time | hour min sec | NOW + 1h 2min 3s | # 1h 2min 3s added to NOW |
-        =>
+        =>
         - ${time} = '2007-04-27 09:14:27'
         - ${secs} = 27
         - ${year} = '2006'
@@ -1305,7 +1305,7 @@
         `modules` argument can be used to specify a comma separated
         list of Python modules to be imported and added to the
***The diff for this file has been truncated for email.***

Reply via email to