Skip to content

Commit 2b56ffe

Browse files
committed
ipy test compatibility (and whitespace cleanup)
1 parent 38cb734 commit 2b56ffe

File tree

6 files changed

+19
-12
lines changed

6 files changed

+19
-12
lines changed

atest/robot/standard_libraries/builtin/log.robot

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ formatter=repr
8787

8888
formatter=ascii
8989
${tc} = Check Test Case ${TEST NAME}
90-
${u} = Set Variable If ${INTERPRETER.is_py2} u ${EMPTY}
91-
${b} = Set Variable If ${INTERPRETER.is_py2} ${EMPTY} b
92-
Check Log Message ${tc.kws[0].msgs[0]} ${u}'Nothing special here'
90+
${u} = Set Variable If ${INTERPRETER.is_py2} u ${EMPTY}
91+
${u2} = Set Variable If ${INTERPRETER.is_py2} and not ${INTERPRETER.is_ironpython} u ${EMPTY}
92+
${b} = Set Variable If ${INTERPRETER.is_py2} and not ${INTERPRETER.is_ironpython} ${EMPTY} b
93+
Check Log Message ${tc.kws[0].msgs[0]} ${u2}'Nothing special here'
9394
Check Log Message ${tc.kws[1].msgs[0]} ${u}'Hyv\\xe4\\xe4 y\\xf6t\\xe4 \\u2603!'
9495
Check Log Message ${tc.kws[2].msgs[0]} 42 DEBUG
9596
Check Log Message ${tc.kws[4].msgs[0]} ${b}'\\x00abc\\xff (formatter=ascii)'

atest/testdata/standard_libraries/builtin/should_be_equal.robot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ formatter=repr/ascii with non-ASCII characters on Python 2
8888
...
8989
... 2) '\\xc4' != 'A'
9090
...
91-
... 3) u'\\xc4' != u'A'
91+
... 3) u'\\xc4' != ${U}'A'
9292
...
9393
... 4) Ä (string) != Ä (string)
9494
...
9595
... 5) '\\xc4' != 'A\\u0308'
9696
...
9797
... 6) u'\\xc4' != u'A\\u0308'
9898
...
99-
... 7) {'A': 2, 'a': 1, '\\xc4': 4, '\\xe4': 3} != {b'a': 1}
99+
... 7) {'A': 2, 'a': 1, '\\xc4': 4, '\\xe4': 3} != ${PREPR_DICT1}
100100
...
101101
... 8) ${ASCII DICT} != {'a': 1}
102102
Ä A

atest/testdata/standard_libraries/builtin/variables_to_verify.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import os
21
from collections import OrderedDict
2+
import os
3+
import sys
34

45
try:
56
ascii
@@ -12,6 +13,9 @@
1213
import jarray
1314

1415

16+
PY3_OR_IPY = sys.version_info[0] > 2 or sys.platform == 'cli'
17+
18+
1519
def get_variables():
1620
variables = dict(
1721
BYTES_WITHOUT_NON_ASCII=b'hyva',
@@ -33,6 +37,8 @@ def get_variables():
3337
DICT_3={'a': 1, 'b': 2, 'c': 3},
3438
)
3539
variables['ASCII_DICT'] = ascii(variables['DICT'])
40+
variables['PREPR_DICT1'] = "{'a': 1}" if PY3_OR_IPY else "{b'a': 1}"
41+
variables['U'] = '' if PY3_OR_IPY else 'u'
3642
if os.name == 'java':
3743
variables.update(get_java_variables(**variables))
3844
return variables

atest/testdata/standard_libraries/remote/timeouts.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Test initial connection failure
2828
Run Keyword And Expect Error ${error}
2929
... Import Library Remote 1.2.3.4:666 timeout=0.2 seconds
3030
${end} = Get Current Date
31-
${elapsed} = Subtract Date From Date ${end} ${start}
31+
${elapsed} = Subtract Date From Date ${end} ${start}
3232
Should Be True ${elapsed} < 10
3333

3434
Test too long keyword execution time

utest/utils/test_asserts.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ def test_assert_equal_with_values_having_same_string_repr(self):
8484

8585
def test_assert_equal_with_custom_formatter(self):
8686
assert_equal(u'hyv\xe4', u'hyv\xe4', formatter=repr)
87-
expected = "u'hyv\\xe4' != u'paha'" if PY2 else "'hyv\xe4' != 'paha'"
88-
assert_raises_with_msg(AE, expected,
89-
assert_equal, u'hyv\xe4', u'paha',
90-
formatter=repr)
87+
assert_raises_with_msg(
88+
AE, "u'hyv\\xe4' != 'paha'" if PY2 else "'hyv\xe4' != 'paha'",
89+
assert_equal, u'hyv\xe4', 'paha', formatter=repr
90+
)
9191
if PY3:
9292
assert_raises_with_msg(AE, "'hyv\\xe4' != 'paha'",
9393
assert_equal, 'hyv\xe4', 'paha',

utest/utils/test_unic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def test_unicode_repr(self):
143143

144144
def test_bytes_repr(self):
145145
obj = BytesRepr()
146-
if PY3:
146+
if PY3 or IRONPYTHON:
147147
expected = obj.unrepr
148148
else:
149149
expected = 'Hyv\\xe4'

0 commit comments

Comments
 (0)