Skip to content

Commit 46dec9c

Browse files
committed
more test cleanup. also fixed the remaining failing test related to handling control chars.
1 parent e28b2b3 commit 46dec9c

2 files changed

Lines changed: 46 additions & 39 deletions

File tree

test/atest/return_values.txt

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,90 @@
11
*** Settings ***
22
Resource resource.txt
3+
Variables arguments.py
4+
Test Template Return Value Should Be
35

46
*** Test Cases ***
57
Return String
6-
Return Value Should Be Return String 'Hello, world!'
8+
Return String Hello, world!
79

810
Return Empty String
9-
Return Value Should Be Return Empty String ''
11+
Return Empty String ${EMPTY}
1012

1113
Return Unicode String
12-
Return Value Should Be Return Unicode String u'Hyv\\u00E4\\u00E4 y\\u00F6t\\u00E4. \\u0421\\u043F\\u0430\\u0441\\u0438\\u0431\\u043E!'
14+
Return Unicode String ${UNICODE STRING}
1315

1416
Return Integer
15-
Return Value Should Be Return Integer 42
16-
Return Value Should Be Return Negative Integer -1
17+
Return Integer ${42}
18+
Return Negative Integer ${-1}
1719

1820
Return Float
19-
Return Value Should Be Return Float 3.14
20-
Return Value Should Be Return Negative Float -0.5
21+
Return Float ${3.14}
22+
Return Negative Float ${-0.5}
2123

2224
Return Zero
23-
Return Value Should Be Return Zero 0
25+
Return Zero ${0}
2426

2527
Return Boolean
26-
Return Value Should Be Return Boolean True True
27-
Return Value Should Be Return Boolean False False
28+
Return Boolean True ${True}
29+
Return Boolean False ${False}
2830

29-
Return Nothing
30-
[Documentation] None/nil/null is not supported by all XML-RPC versions and thus it is converted to an empty string
31-
Return Value Should Be Return Nothing ''
31+
Return None
32+
[Documentation] None is not supported by all XML-RPC versions and thus it is converted to an empty string
33+
Return Nothing ${EMPTY}
3234

3335
Return Arbitrary Object
34-
[Documentation] Arbitrary objects cannot be transferred over XML-RPC and thus only their string presentation is returned
35-
Return Value Should Be Return Object '<MyObject>'
36+
[Documentation] Arbitrary objects cannot be transferred over XML-RPC and thus only their string presentation is returned
37+
Return Object <MyObject>
3638

3739
Return List
38-
Return Value Should Be Return List ['One', -2, False]
39-
Return Value Should Be Return Empty List []
40+
Return List ${LIST}
41+
Return Empty List ${EMPTY LIST}
4042

4143
Return List Containing None
42-
Return Value Should Be Return List Containing None ['']
44+
Return List Containing None [''] eval
4345

4446
Return List Containing Arbitrary Objects
45-
Return Value Should Be Return List Containing Objects ['<MyObject1>', '<MyObject2>']
47+
Return List Containing Objects ['<MyObject1>', '<MyObject2>'] eval
4648

4749
Return Nested List
48-
Return Value Should Be Return Nested List [ [True, False], [[1, '', '<MyObject>', {}]] ]
50+
Return Nested List [[True, False], [[1, '', '<MyObject>', {}]]] eval
4951

5052
Return Tuple
51-
[Documentation] Tuples are converted to lists
52-
Return Value Should Be Return Tuple [1, 'two', True]
53-
Return Value Should Be Return Empty Tuple []
54-
Return Value Should Be Return Nested Tuple [ [True, False], [[1, '', '<MyObject>', {}]] ]
53+
[Documentation] Tuples are converted to lists
54+
Return Tuple ${LIST}
55+
Return Empty Tuple ${EMPTY LIST}
56+
Return Nested Tuple [[True, False], [[1, '', '<MyObject>', {}]]] eval
5557

5658
Return Dictionary
57-
Return Value Should Be Return Dictionary {'one': 1, 'spam': 'eggs'}
58-
Return Value Should Be Return Empty Dictionary {}
59+
Return Dictionary ${DICT}
60+
Return Empty Dictionary ${EMPTY DICT}
5961

6062
Return Dictionary With Non-String Keys
61-
[Documentation] XML-RPC supports only strings as keys so must convert them
62-
Return Value Should Be Return Dictionary With Non String Keys {'1': 2, '': 1}
63+
[Documentation] XML-RPC supports only strings as keys so must convert them
64+
Return Dictionary With Non String Keys {'1': 2, '': 1} eval
6365

6466
Return Dictionary Containing None
65-
Return Value Should Be Return Dictionary Containing None {'As value': '', '': 'As key'}
67+
Return Dictionary Containing None {'As value': '', '': 'As key'} eval
6668

6769
Return Dictionary Containing Objects
68-
Return Value Should Be Return Dictionary Containing Objects {'As value': '<MyObject1>', '<MyObject2>': 'As key'}
70+
Return Dictionary Containing Objects {'As value': '<MyObject1>', '<MyObject2>': 'As key'} eval
6971

7072
Return Nested Dictionary
71-
Return Value Should Be Return Nested Dictionary {'1': {'': False}, '2': {'A': {'n': ''}, 'B': {'o': '<MyObject>', 'e': {}}} }
73+
Return Nested Dictionary {'1': {'': False}, '2': {'A': {'n': ''}, 'B': {'o': '<MyObject>', 'e': {}}}} eval
7274

7375
Return Control Char
74-
[Documentation] FAIL REGEXP: Processing XML-RPC return value failed. Most often this happens when the return value contains characters that are not valid in XML. Original error was: ExpatError: .*
75-
Return Control Char
76+
[Documentation] May also fail with ExpatError.
77+
Return Control Char ${CONTROL CHAR}
7678

7779
*** Keywords ***
7880
Return Value Should Be
79-
[Arguments] ${keyword} ${expected}
80-
${actual} = Run Keyword ${keyword}
81-
${expected} = Evaluate ${expected}
82-
Should Be Equal ${actual} ${expected}
83-
81+
[Arguments] ${keyword} ${expected} ${evaluate}=
82+
${actual} = Run Keyword ${keyword}
83+
${tester} = Set Variable If "${evaluate}"
84+
... Should Be Equal Evaluated Should Be Equal
85+
Run Keyword ${tester} ${actual} ${expected}
86+
87+
Should Be Equal Evaluated
88+
[Arguments] ${actual} ${expected}
89+
${expected} = Evaluate ${expected}
90+
Should Be Equal ${actual} ${expected}

test/libs/examplelib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def return_nested_list(self):
243243
return [[True, False], [[1, None, MyObject(), {}]]]
244244

245245
def return_tuple(self):
246-
return (1, 'two', True)
246+
return ('One', -2, False)
247247

248248
def return_empty_tuple(self):
249249
return ()

0 commit comments

Comments
 (0)