3 new revisions:

Revision: 93b6cc5a16ba
Author:   Pekka Klärck
Date:     Mon Jul  2 08:01:57 2012
Log:      unused import
http://code.google.com/p/robotframework/source/detail?r=93b6cc5a16ba

Revision: 783dd682f117
Author:   Pekka Klärck
Date:     Mon Jul  2 08:40:09 2012
Log: XML library tests: Fixed tests that only work with 2.7 (couldn't run t...
http://code.google.com/p/robotframework/source/detail?r=783dd682f117

Revision: af56c7d9142d
Author:   Pekka Klärck
Date:     Mon Jul  2 08:45:27 2012
Log: XML lib: Only warn, don't fail, when using xpaths that may not work wi...
http://code.google.com/p/robotframework/source/detail?r=af56c7d9142d

==============================================================================
Revision: 93b6cc5a16ba
Author:   Pekka Klärck
Date:     Mon Jul  2 08:01:57 2012
Log:      unused import
http://code.google.com/p/robotframework/source/detail?r=93b6cc5a16ba

Modified:
 /src/robot/utils/etreewrapper.py

=======================================
--- /src/robot/utils/etreewrapper.py    Sat Jun 30 16:02:25 2012
+++ /src/robot/utils/etreewrapper.py    Mon Jul  2 08:01:57 2012
@@ -12,7 +12,6 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.

-import os
 import sys
 from StringIO import StringIO


==============================================================================
Revision: 783dd682f117
Author:   Pekka Klärck
Date:     Mon Jul  2 08:40:09 2012
Log: XML library tests: Fixed tests that only work with 2.7 (couldn't run them earlier) and removed non-applicable test.
http://code.google.com/p/robotframework/source/detail?r=783dd682f117

Modified:
 /atest/testdata/standard_libraries/xml/element_attribute.txt
 /atest/testdata/standard_libraries/xml/parsing.txt
 /atest/testdata/standard_libraries/xml/xpath.txt

=======================================
--- /atest/testdata/standard_libraries/xml/element_attribute.txt Sun Jul 1 14:35:54 2012 +++ /atest/testdata/standard_libraries/xml/element_attribute.txt Mon Jul 2 08:40:09 2012
@@ -65,7 +65,7 @@
 Non-ASCII
     ${attr}=    Get Element Attribute    <täg ä='ö'/>    ä
     Should Be Equal    ${attr}    ö
-    ${attrs}=    Get Element Attribute    <täg ä='ö'/>
-    Should Be True    ${attrs} == {u'\\xf6': u'\\xe4'}
+    ${attrs}=    Get Element Attributes    <täg ä='ö'/>
+    Should Be True    ${attrs} == {u'\\xe4': u'\\xf6'}
     Element Attribute Should Be    <täg ä='ö'/>    ä    ö
     Element Attribute Should Match    <täg ä='öö'/>    ä    ö?
=======================================
--- /atest/testdata/standard_libraries/xml/parsing.txt Sat Jun 30 22:30:06 2012 +++ /atest/testdata/standard_libraries/xml/parsing.txt Mon Jul 2 08:40:09 2012
@@ -12,11 +12,11 @@
     Should be equal     ${root.text}     päivää

 Parse invalid file
-    [Documentation]    FAIL REGEXP: (SyntaxError|ExpatError): .*
+    [Documentation]    FAIL REGEXP: .*Error: .*
     Parse XML    ${CURDIR}/parsing.txt

 Parse invalid string
-    [Documentation]    FAIL REGEXP: (SyntaxError|ExpatError): .*
+    [Documentation]    FAIL REGEXP: .*Error: .*
     Parse XML    <kekkonen>urho

 Parse non-existing file
=======================================
--- /atest/testdata/standard_libraries/xml/xpath.txt Sun Jul 1 15:36:45 2012 +++ /atest/testdata/standard_libraries/xml/xpath.txt Mon Jul 2 08:40:09 2012
@@ -33,14 +33,6 @@
     \    Should Be Equal    ${elem.tag}    child
     Should Be Equal    ${elem.text}    text

-'..'
-    [Template]    NONE
-    ${child}=    Get Element    ${test}    .//grandchild
-    ${parent}=    Get Element    ${child}    ..
-    Should Be Equal    ${parent.attrib['id']}    2
-    ${another}=    Get Element    ${child}    ../../another
-    Should Be Equal    ${another.attrib['attr']}    value
-
 '[@attrib]'
     [Documentation]    FAIL No element matching 'child[@nonex]' found.
     child[@a2]    child    ${NONE}
@@ -54,8 +46,8 @@

 '[tag]'
     [Documentation]    FAIL No element matching '.[nonex]' found.
-    .[grandchild]    child
-    .[nonex]    not-found
+    *[grandchild]    child
+    child[nonex]    not-found

 '[position]'
     [Documentation]    FAIL No element matching 'child[4]' found.
@@ -79,4 +71,4 @@
     [Arguments]    ${xpath}    ${tag}    ${text}=IGNORE    ${xml}=${TEST}
     ${element}=     Get Element    ${xml}    ${xpath}
     Should Be Equal    ${element.tag}    ${tag}
- Run Keyword If '${text}' != 'IGNORE' Should Be Equal ${element.text} ${text} + Run Keyword If '''${text}''' != 'IGNORE' Should Be Equal ${element.text} ${text}

==============================================================================
Revision: af56c7d9142d
Author:   Pekka Klärck
Date:     Mon Jul  2 08:45:27 2012
Log: XML lib: Only warn, don't fail, when using xpaths that may not work with older ET versions.
http://code.google.com/p/robotframework/source/detail?r=af56c7d9142d

Modified:
 /src/robot/libraries/XML.py

=======================================
--- /src/robot/libraries/XML.py Sun Jul  1 15:36:45 2012
+++ /src/robot/libraries/XML.py Mon Jul  2 08:45:27 2012
@@ -58,19 +58,20 @@
     def get_elements(self, source, xpath):
         return self._get_parent(source).findall(self._get_xpath(xpath))

-    if sys.version_info < (2, 7):
+    if sys.version_info >= (2, 7):
         def _get_xpath(self, xpath):
+            return xpath
+    else:
+        def _get_xpath(self, xpath):
             try:
                 return str(xpath)
             except UnicodeError:
-                if xpath.replace('/', '').isalnum():
-                    return xpath
- raise RuntimeError('Non-ASCII XPATHs containing other than ' - 'tag names are not supported with Python '
-                                   'interpreters below 2.7.')
-    else:
-        def _get_xpath(self, xpath):
-            return xpath
+                if not xpath.replace('/', '').isalnum():
+ logger.warn('XPATHs containing non-ASCII characters and ' + 'other than tag names do not always work on ' + 'Python/Jython earlier than 2.7. Verify results '
+                                'manually and consider upgrading to 2.7.')
+                return xpath

def get_element_text(self, source, xpath='.', normalize_whitespace=False):
         element = self.get_element(source, xpath)

Reply via email to