3 new revisions:

Revision: 9a4f9e26dfba
Branch:   default
Author:   Tatu Kairi <tatu.ka...@gmail.com>
Date:     Thu Apr 25 04:34:21 2013
Log: Cleaned out tests relating to named arguments with dynamic libraries, ...
http://code.google.com/p/robotframework/source/detail?r=9a4f9e26dfba

Revision: fcef873592b2
Branch:   default
Author:   Tatu Kairi <tatu.ka...@gmail.com>
Date:     Thu Apr 25 04:35:28 2013
Log: Added tests to check, that invalid argspec gives correct error message...
http://code.google.com/p/robotframework/source/detail?r=fcef873592b2

Revision: af33a4cbedb5
Branch:   default
Author:   Tatu Kairi <tatu.ka...@gmail.com>
Date:     Thu Apr 25 04:35:50 2013
Log:      merge
http://code.google.com/p/robotframework/source/detail?r=af33a4cbedb5

==============================================================================
Revision: 9a4f9e26dfba
Branch:   default
Author:   Tatu Kairi <tatu.ka...@gmail.com>
Date:     Thu Apr 25 04:34:21 2013
Log: Cleaned out tests relating to named arguments with dynamic libraries, as these are tested elsewhere better
http://code.google.com/p/robotframework/source/detail?r=9a4f9e26dfba

Deleted:
 /atest/testdata/test_libraries/dynamic_libraries/impl_dynlib.py
Modified:
 /atest/robot/test_libraries/dynamic_library_python.txt
 /atest/testdata/test_libraries/dynamic_library_python.txt

=======================================
--- /atest/testdata/test_libraries/dynamic_libraries/impl_dynlib.py Fri Apr 5 05:23:10 2013
+++ /dev/null
@@ -1,11 +0,0 @@
-def impl_say_hello(first_name="John"):
-    print "Hello %s." % first_name
-
-def impl_say_goodbye(first_name="John", last_name="Smith"):
-    print "Good bye %s %s." % (first_name, last_name)
-
-def impl_say_something_to(message, to_whom='You', from_who='Me'):
-    print "%s! %s. -BR, %s" % (to_whom, message, from_who)
-
-def impl_a_keyword(a, b=1):
-    print a, b
=======================================
--- /atest/robot/test_libraries/dynamic_library_python.txt Fri Apr 5 05:23:10 2013 +++ /atest/robot/test_libraries/dynamic_library_python.txt Thu Apr 25 04:34:21 2013
@@ -20,23 +20,6 @@

 Not Found Keyword
     Check Test Case  ${TESTNAME}
-
-Dynamic libraries should handle named arguments
-    ${tc}=    Check Test Case  ${TESTNAME}
-    Check Log Message    ${tc.kws[0].msgs[0]}    Hello John.
-    Check Log Message    ${tc.kws[1].msgs[0]}    Hello Mike.
-    Check Log Message    ${tc.kws[2].msgs[0]}    Good bye John Ventura.
-    Check Log Message    ${tc.kws[3].msgs[0]}    Good bye John Smith.
-    Check Log Message    ${tc.kws[4].msgs[0]}    You! a message. -BR, Me
- Check Log Message ${tc.kws[5].msgs[0]} Patrick! this is my message. -BR, someone - Check Log Message ${tc.kws[6].msgs[0]} You! a message. -BR, Jesse Ventura - Check Log Message ${tc.kws[7].msgs[0]} Randy Savage! this is my message. -BR, Hulk Hogan
-
-
-Dynamic libraries should handle using named arguments for positional arguments
-    ${tc}=    Check Test Case  ${TESTNAME}
-    Check Log Message    ${tc.kws[0].msgs[0]}    12 1
-

 Dynamic libraries should work without argument specification
     ${tc}=    Check test Case    ${TESTNAME}
@@ -44,7 +27,8 @@
Check Log Message ${tc.kws[1].msgs[0]} x: something, y: something else
     Check Log Message    ${tc.kws[2].msgs[0]}    x: something, y: 0

-
Dynamic libraries should match named arguments same way as with user keywords
     ${tc}=    Check Test Case  ${TESTNAME}
     Check Log Message    ${tc.kws[0].msgs[0]}    x y=1 z=2
+
+
=======================================
--- /atest/testdata/test_libraries/dynamic_library_python.txt Fri Apr 5 05:23:10 2013 +++ /atest/testdata/test_libraries/dynamic_library_python.txt Thu Apr 25 04:34:21 2013
@@ -2,9 +2,9 @@
 Library         RunKeywordLibrary
 Library         RunKeywordLibrary.RunKeywordButNoGetKeywordNamesLibrary
 Library         RunKeywordLibrary.GlobalRunKeywordLibrary
-Library         ${CURDIR}/dynamic_libraries/DynamicLibrary.py
 Library         ${CURDIR}/dynamic_libraries/DynamicLibraryWithoutArgspec.py

+
 *** Test Cases ***
 Passing, Logging and Returning
     ${ret} =  RunKeywordLibrary. Run Keyword That Passes  Hi  tellus
@@ -33,22 +33,6 @@
[Documentation] FAIL No keyword with name 'Get Keyword That Does Not Exist' found.
     Get Keyword That Does Not Exist

-Dynamic libraries should handle named arguments
-    [Documentation]    PASS
-    Say Hello
-    Say Hello    Mike
-    Say Goodbye    last_name=Ventura
-    Say Goodbye
-    Say Something To     a message
-    Say Something To     this is my message    Patrick    someone
-    Say Something To     a message    from_who=Jesse Ventura
- Say Something To this is my message from_who=Hulk Hogan to_whom=Randy Savage
-
-
-Dynamic libraries should handle using named arguments for positional arguments
-    A keyword    a=12
-
-
 Dynamic libraries should work without argument specification
     [Documentation]    PASS
     Do Something    print this
@@ -63,3 +47,5 @@
     ...                positional arguments.
     ...                e.g. this should print strings 'x', 'y=1' and 'z=2'
     Do something third    x    y=1    z=2
+
+

==============================================================================
Revision: fcef873592b2
Branch:   default
Author:   Tatu Kairi <tatu.ka...@gmail.com>
Date:     Thu Apr 25 04:35:28 2013
Log: Added tests to check, that invalid argspec gives correct error messages with dynamic libraries
http://code.google.com/p/robotframework/source/detail?r=fcef873592b2

Added:
 /atest/robot/test_libraries/dynamic_libraries_with_invalid_argspec.txt
 /atest/testdata/test_libraries/dynamic_libraries_with_invalid_argspec.txt
Modified:
 /atest/testdata/test_libraries/dynamic_libraries/DynamicLibrary.py

=======================================
--- /dev/null
+++ /atest/robot/test_libraries/dynamic_libraries_with_invalid_argspec.txt Thu Apr 25 04:35:28 2013
@@ -0,0 +1,30 @@
+*** Settings ***
+Suite Setup Run Tests ${EMPTY} test_libraries/dynamic_libraries_with_invalid_argspec.txt
+Force Tags      regression  jybot  pybot
+Resource        atest_resource.txt
+
+*** Test Cases ***
+
+Argspec consists of something else than strings
+    Error message should be correct    1    argspec with other than strings
+ ... Calling dynamic method 'get_keyword_arguments' failed: Return value must be list of strings.
+
+Argspec has varargs before positional arguments
+    Error message should be correct    3    varargs before positional args
+    ...    Only last argument can be varargs.
+
+Argspec has varargs before named arguments
+    Error message should be correct    2    varargs before named args
+    ...    Only last argument can be varargs.
+
+Argspec has named arguments before positional
+    Error message should be correct    0    named args before positional
+    ...     Non-default argument after default arguments.
+
+
+*** Keywords ***
+
+Error message should be correct
+    [Arguments]    ${index}    ${kw}    ${msg}
+    Check Test Case    ${TESTNAME}
+ Check Log Message ${ERRORS[${index}]} Adding keyword '${kw}' to library 'DynamicLibrary' failed: ${msg} WARN
=======================================
--- /dev/null
+++ /atest/testdata/test_libraries/dynamic_libraries_with_invalid_argspec.txt Thu Apr 25 04:35:28 2013
@@ -0,0 +1,20 @@
+*** Settings ***
+Library         ${CURDIR}/dynamic_libraries/DynamicLibrary.py
+
+*** Test Cases ***
+
+Argspec consists of something else than strings
+ [Documentation] FAIL No keyword with name 'Argspec With Other Than Strings' found.
+    Argspec With Other Than Strings
+
+Argspec has varargs before positional arguments
+ [Documentation] FAIL No keyword with name 'Varargs Before Positional Args' found.
+    Varargs Before Positional Args
+
+Argspec has varargs before named arguments
+ [Documentation] FAIL No keyword with name 'Varargs Before Named Args' found.
+    Varargs Before Named Args
+
+Argspec has named arguments before positional
+ [Documentation] FAIL No keyword with name 'Named Args Before Positional' found.
+    Named Args Before Positional
=======================================
--- /atest/testdata/test_libraries/dynamic_libraries/DynamicLibrary.py Fri Apr 5 05:23:10 2013 +++ /atest/testdata/test_libraries/dynamic_libraries/DynamicLibrary.py Thu Apr 25 04:35:28 2013
@@ -1,9 +1,10 @@
-from impl_dynlib import impl_say_hello, impl_say_goodbye, impl_say_something_to, impl_a_keyword
-
-KEYWORDS = {'say hello': (impl_say_hello, ['first_name=John']),
- 'say goodbye': (impl_say_goodbye, ['first_name=John', 'last_name=Smith']), - 'say something to': (impl_say_something_to, ['message', 'to_whom=You', 'from_who=Me']),
-            'a keyword': (impl_a_keyword, ['a', 'b=1'])}
+KEYWORDS = {
+    'argspec with other than strings': (lambda a, *x: (a, x), [1, 2]),
+ 'varargs before positional args': (lambda a, *x: (a, x), ['*varargs', 'a']), + 'varargs before named args': (lambda a=1, *x: (a, x), ['*varargs', 'a=1']),
+    'named args before positional': (lambda a, b: (a, b), ['a=1', 'b']),
+    'method': (lambda a: a, ['a'])
+}

 class DynamicLibrary(object):


==============================================================================
Revision: af33a4cbedb5
Branch:   default
Author:   Tatu Kairi <tatu.ka...@gmail.com>
Date:     Thu Apr 25 04:35:50 2013
Log:      merge
http://code.google.com/p/robotframework/source/detail?r=af33a4cbedb5

Deleted:
 /atest/robot/standard_libraries/test_process_library.txt
 /atest/testdata/standard_libraries/test_process_library.txt
 /src/robot/running/javaargcoercer.py

=======================================
--- /atest/robot/standard_libraries/test_process_library.txt Wed Apr 24 04:14:36 2013
+++ /dev/null
@@ -1,83 +0,0 @@
-*** Settings ***
-Suite Setup Run Tests ${EMPTY} standard_libraries/test_process_library.txt
-Force Tags       regression    pybot    jybot
-Resource         atest_resource.txt
-
-*** Test Cases ***
-Library Namespace should be global
-    Check Test Case    ${TESTNAME}
-
-Running a process
-    Check Test Case    ${TESTNAME}
-
-Error in exit code and stderr output
-    Check Test Case    ${TESTNAME}
-
-Start And Wait Process
-    Check Test Case    ${TESTNAME}
-
-Switching active process
-    Check Test Case    ${TESTNAME}
-
-Run process does not change active process
-    Check Test Case    ${TESTNAME}
-
-Killing process
-    Check Test Case    ${TESTNAME}
-
-Terminating process
-    Check Test Case    ${TESTNAME}
-
-Pid
-    Check Test Case    ${TESTNAME}
-
-Starting many processes and killing all
-    Check Test Case    ${TESTNAME}
-
-Test Process Should Be Alive
-    Check Test Case    ${TESTNAME}
-
-Test Process Should Be Dead
-    Check Test Case    ${TESTNAME}
-
-Kill Process Which Does Not Exist
-    Check Test Case    ${TESTNAME}
-
-Wait For Process Which Does Not Exist
-    Check Test Case    ${TESTNAME}
-
-Change Current Working Directory
-    Check Test Case    ${TESTNAME}
-
-Setting Stdout
-    Check Test Case    ${TESTNAME}
-
-Setting Stderr
-    Check Test Case    ${TESTNAME}
-
-Escaping equals sign
-    Check Test Case    ${TESTNAME}
-
-Running a process in a shell
-    Check Test Case    ${TESTNAME}
-
-Input things to process
-    Check Test Case    ${TESTNAME}
-
-Process alias
-    Check Test Case    ${TESTNAME}
-
-Lot of output
-    Check Test Case    ${TESTNAME}
-
-Redirecting Stderr to Stdout
-    Check Test Case    ${TESTNAME}
-
-Redirecting Stderr to Stdout with filename
-    Check Test Case    ${TESTNAME}
-
-Current working directory should be used with stdout and stderr
-    Check Test Case    ${TESTNAME}
-
-Current working directory should not be used with stdout and stderr when absolute path in use
-    Check Test Case    ${TESTNAME}
=======================================
--- /atest/testdata/standard_libraries/test_process_library.txt Wed Apr 24 03:47:25 2013
+++ /dev/null
@@ -1,218 +0,0 @@
-*** Settings ***
-Library                 Process.py
-Library                 OperatingSystem
-Suite Setup             Endless process    suite_process
-Test Teardown           Restart Suite Process If Needed
-Suite Teardown          Terminate Process       suite_process
-
-*** Test Cases ***
-Library Namespace should be global
-          Process Should Be Alive   suite_process
-
-Running a process
-          ${result}=          Run Python Process          print 'hello'
- Result should equal ${result} stdout=hello\n exit_code=0
-
-Error in exit code and stderr output
-          ${result}=          Run Python Process          1/0
- Result should equal ${result} stderr=*ZeroDivisionError: integer division or modulo by zero* exit_code=1
-
-Start And Wait Process
- ${handle}= Start Python Process import time;time.sleep(0.1)
-          ${is_alive}=          Process Is Alive          ${handle}
-          Should Be True          ${is_alive}
-          Wait For Process          ${handle}
-          Process Should Be Dead          ${handle}
-
-Switching active process
-          ${process_one}=       Endless process    one
-          Terminate Process          one
-          ${process_two}=       Endless process    two
-          Process Should Be Alive   ${process_two}
-          Switch Active Process     one
-          Process Should Be Dead
-          Switch Active Process     two
-          Process Should Be Alive
-          Terminate Process
-
-Run process does not change active process
-          Endless process    active
-          ${expected id}=    Get Process Id
-          Run Python Process    1+1
-          ${id}=             Get Process Id
-          Should Be Equal     ${expected id}   ${id}
-
-
-Killing process
-          ${handle}=          Endless process
-          ${is_alive}=          Process Is Alive          ${handle}
-          Should Be True          ${is_alive}
-          Terminate Process          ${handle}   kill=${True}
-          Wait For Process          ${handle}
-          Process Should Be Dead          ${handle}
-
-Terminating process
-          ${handle}=          Endless process
-          Terminate Process          ${handle}
-          Wait For Process          ${handle}
-          Process Should Be Dead          ${handle}
-
-Pid
-          ${handle}=          Endless process
-          ${pid}=          Get Process Id          ${handle}
-          Evaluate    os.kill(int(${pid}),signal.SIGTERM)    os,signal
-          #Run Process          kill          -9          ${pid}
-          Wait For Process          ${handle}
-          Process Should Be Dead          ${handle}
-
-Starting many processes and killing all
-          ${handle1}=          Endless process
-          ${handle2}=          Endless process
-          ${handle3}=          Endless process
-          ${handle4}=          Endless process
-          ${handle5}=          Endless process
-          Sleep          0.1
-          Process Should be alive          ${handle1}
-          Process Should be alive          ${handle2}
-          Process Should be alive          ${handle3}
-          Process Should be alive          ${handle4}
-          Process Should be alive          ${handle5}
-          Kill all processes
-          Sleep          0.1
-          Process Should Be Dead          ${handle1}
-          Process Should Be Dead          ${handle2}
-          Process Should Be Dead          ${handle3}
-          Process Should Be Dead          ${handle4}
-          Process Should Be Dead          ${handle5}
-
-Test Process Should Be Alive
-          ${handle}=          Endless process
-          Process Should Be Alive          ${handle}
-          Kill all processes
-          Wait For Process          ${handle}
- Run Keyword And Expect Error Process is not alive Process Should Be Alive ${handle}
-
-Test Process Should Be Dead
-          ${handle}=          Endless process
- Run Keyword And Expect Error Process is alive Process Should Be Dead ${handle}
-          Kill all processes
-          Wait For Process          ${handle}
-          Process Should Be Dead          ${handle}
-
-Kill Process Which Does Not Exist
-          ${handle}=          Endless process
-          Terminate Process          ${handle}   kill=${True}
-          Terminate Process          ${handle}   kill=${True}
-
-Wait For Process Which Does Not Exist
-          ${handle}=          Endless process
-          Terminate Process          ${handle}   kill=${True}
-          Wait For Process          ${handle}
-
-Change Current Working Directory
- ${result}= Run Process python -c import os; print os.path.abspath(os.curdir); cwd=. - ${result2}= Run Process python -c import os; print os.path.abspath(os.curdir); cwd=.. - Should Not Be Equal ${result.stdout} ${result2.stdout}
-
-Setting Stdout
- ${result}= Run Process python -c "print 'hello'" shell=True stdout=${TEMPDIR}${/}myfile_1.txt
-          ${output}=            Get File     ${TEMPDIR}${/}myfile_1.txt
-          Should Not Be Empty    ${output}
-          Should Be Equal     ${result.stdout}      ${output}
-          #[Teardown]  Remove File   ${TEMPDIR}${/}myfile_1.txt
-
-Setting Stderr
- ${result}= Run Process python -c "1/0" shell=True stderr=${TEMPDIR}${/}myfile.txt
-          ${output}=            Get File     ${TEMPDIR}${/}myfile.txt
-          Should Not Be Empty    ${output}
-          Should Be Equal     ${result.stderr}      ${output}
-          [Teardown]  Remove File   ${TEMPDIR}${/}myfile.txt
-
-Escaping equals sign
- ${result}= Run Process python -c print 'stderr\=bar.buu' shell=True
-          Result should equal       ${result}     stdout=*stderr=bar.buu*
-
-Running a process in a shell
- ${result}= Run Process python -c "print 'hello'" shell=True - Result should equal ${result} stdout=*hello* exit_code=0 - Run Keyword And Expect Error * Run Process python -c "print 'hello'" shell=${False}
-
-Input things to process
- Start New Process python -c "print 'inp %s' % raw_input()" shell=True
-          Input To Process     some input
-          ${result}=         Wait For Process
-          Should Match       ${result.stdout}      *inp some input*
-
-Process alias
- ${handle}= Start New Process python -c "print 'hello'" shell=True alias=hello
-          ${pid_by_handle}=   Get process id   ${handle}
-          ${pid_by_alias}=    Get process id   hello
-          Should Be Equal    ${pid_by_handle}    ${pid_by_alias}
-
-Lot of output   [Tags]    performance
- ${handle}= Run Process python -vc "for i in range(350000): \tprint 'a'*400" shell=True stdout=${TEMPDIR}${/}myout.txt
-          Log      ${handle.exit_code}
-          Log      ${handle.stderr}
-          File Should Not Be Empty     ${TEMPDIR}${/}myout.txt
-          [Teardown]  Remove File   ${TEMPDIR}${/}myout.txt
-
-Redirecting Stderr to Stdout
- ${result}= Run Process python -c print 'hello';1/0 stderr=STDOUT
-          Should Match     ${result.stdout}   *hello*
-          Should Match     ${result.stdout}   *ZeroDivisionError*
-          Log    ${result.stderr}
-
-Redirecting Stderr to Stdout with filename
- ${result}= Run Process python -c print 'hello';1/0 stdout=filename.txt stderr=filename.txt
-          Should Match     ${result.stdout}   *hello*
-          Should Match     ${result.stdout}   *ZeroDivisionError*
-          Log    ${result.stderr}
-          [Teardown]  Remove File   filename.txt
-
-Current working directory should be used with stdout and stderr
-          Create Directory    ${TEMPDIR}${/}hc
- ${result}= Run Process python -c print 'moon kuu';1/0 cwd=${TEMPDIR}${/}hc stdout=myout.txt stderr=myerr.txt
-          ${output}=        Get File     ${TEMPDIR}${/}hc${/}myout.txt
-          ${output2}=       Get File     ${TEMPDIR}${/}hc${/}myerr.txt
-          Should Match     ${output}      *moon kuu*
-          Should Match     ${output2}     *ZeroDivisionError*
-          [Teardown]    Remove Directory    ${TEMPDIR}${/}hc    True
-
-Current working directory should not be used with stdout and stderr when absolute path in use
-          Create Directory    ${TEMPDIR}${/}hc
-          ${stdout_path}=   Evaluate   os.path.abspath('myout.txt')    os
- ${result}= Run Process python -c print 'moon kuu';1/0 cwd=${TEMPDIR}${/}hc stdout=${stdout_path} stderr=myerr.txt
-          ${output}=        Get File     ${stdout_path}
-          ${output2}=       Get File     ${TEMPDIR}${/}hc${/}myerr.txt
-          Should Match     ${output}      *moon kuu*
-          Should Match     ${output2}     *ZeroDivisionError*
-          [Teardown]    Remove Directory    ${TEMPDIR}${/}hc    True
-
-
-*** Keywords ***
-Endless process
-          [Arguments]       ${alias}=${null}
- ${handle}= Start Python Process while True: pass; alias=${alias}
-          [Return]          ${handle}
-
-Result should equal
- [Arguments] ${result} ${stdout}= ${stderr}= ${exit_code}=0
-          Should Match          ${result.stdout}          ${stdout}
-          Should Match          ${result.stderr}          ${stderr}
- Should Be Equal As Integers ${result.exit_code} ${exit_code}
-
-Start Python Process
-          [Arguments]          ${command}      ${alias}=${null}
- ${handle}= Start New Process python -c ${command} alias=${alias}
-          [Return]          ${handle}
-
-Run Python Process
-          [Arguments]          ${command}
- ${result}= Run Process python -c ${command}
-          Log    ${result.exit_code}
-          Log    ${result.stderr}
-          [Return]          ${result}
-
-Restart Suite Process If Needed
-         ${alive}=    Process Is Alive  suite_process
-         Run Keyword If  not ${alive}   Endless Process   suite_process
=======================================
--- /src/robot/running/javaargcoercer.py        Tue Apr 16 01:43:53 2013
+++ /dev/null
@@ -1,104 +0,0 @@
-#  Copyright 2008-2012 Nokia Siemens Networks Oyj
-#
-#  Licensed under the Apache License, Version 2.0 (the "License");
-#  you may not use this file except in compliance with the License.
-#  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-
-from java.lang import Byte, Short, Integer, Long, Boolean, Float, Double
-
-
-class ArgumentCoercer:
-
-    def __init__(self, signatures):
-        types = self._parse_types(signatures)
-        self._coercers = [_CoercionFunction(t, i+1) for i, t in types]
-
-    def _parse_types(self, signatures):
-        types = {}
-        for sig in signatures:
-            for index, arg in enumerate(sig.args):
-                types.setdefault(index, []).append(arg)
-        return sorted(types.items())
-
-    def coerce(self, args):
-        return [coercer(arg) for coercer, arg in zip(self._coercers, args)]
-
-
-class _CoercionFunction:
-    _bool_types = [Boolean]
-    _int_types = [Byte, Short, Integer, Long]
-    _float_types = [Float, Double]
-    _bool_primitives = ['boolean']
-    _int_primitives = ['byte', 'short', 'int', 'long']
-    _float_primitives = ['float', 'double']
-    _bool_primitives = ["<type 'boolean'>"]
-    _int_primitives = ["<type '%s'>" % p for p in _int_primitives]
-    _float_primitives = ["<type '%s'>" % p for p in _float_primitives]
-
-    def __init__(self, arg_types, position):
-        self._position = position
-        self.__coercer = None
-        for arg in arg_types:
-            if not (self._set_bool(arg) or
-                    self._set_int(arg) or
-                    self._set_float(arg)):
-                self.__coercer = self._no_coercion
-
-    def __call__(self, arg):
-        if not isinstance(arg, basestring):
-            return arg
-        return self.__coercer(arg)
-
-    def _set_bool(self, arg):
-        return self._set_coercer(arg, self._bool_types,
-                                 self._bool_primitives, self._to_bool)
-
-    def _set_int(self, arg):
-        return self._set_coercer(arg, self._int_types,
-                                 self._int_primitives, self._to_int)
-
-    def _set_float(self, arg):
-        return self._set_coercer(arg, self._float_types,
-                                 self._float_primitives, self._to_float)
-
-    def _set_coercer(self, arg, type_list, primitive_list, coercer):
-        if arg in type_list or str(arg) in primitive_list:
-            if self.__coercer is None:
-                self.__coercer = coercer
-            elif self.__coercer != coercer:
-                self.__coercer = self._no_coercion
-            return True
-        return False
-
-    def _to_bool(self, arg):
-        try:
-            return {'false': False, 'true': True}[arg.lower()]
-        except KeyError:
-            self._coercion_failed('boolean')
-
-    def _to_int(self, arg):
-        try:
-            return int(arg)
-        except ValueError:
-            self._coercion_failed('integer')
-
-    def _to_float(self, arg):
-        try:
-            return float(arg)
-        except ValueError:
-            self._coercion_failed('floating point number')
-
-    def _no_coercion(self, arg):
-        return arg
-
-    def _coercion_failed(self, arg_type):
-        raise ValueError('Argument at position %d cannot be coerced to %s'
-                         % (self._position, arg_type))

--

--- 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.


Reply via email to