Skip to content

Commit e3c41f8

Browse files
committed
Type conversion: 'long' as an alias for 'int'
1 parent 25d0116 commit e3c41f8

File tree

6 files changed

+17
-8
lines changed

6 files changed

+17
-8
lines changed

atest/testdata/keywords/type_conversion/AnnotationsWithAliases.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ def int_(argument: 'INT', expected=None):
1111
_validate_type(argument, expected)
1212

1313

14+
def long_(argument: 'lOnG', expected=None):
15+
_validate_type(argument, expected)
16+
17+
1418
def float_(argument: 'Float', expected=None):
1519
_validate_type(argument, expected)
1620

atest/testdata/keywords/type_conversion/KeywordDecoratorWithAliases.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,22 @@
66
from robot.utils import unicode
77

88

9-
@keyword(types=['Integer']) # type is given as str
9+
@keyword(types=['Integer']) # type always is given as str
1010
def integer(argument, expected=None):
1111
_validate_type(argument, expected)
1212

1313

14-
@keyword(types=[u'INT']) # type is unicode on Python 2
14+
@keyword(types=[u'INT']) # type given as unicode on Python 2
1515
def int_(argument, expected=None):
1616
_validate_type(argument, expected)
1717

1818

19-
@keyword(types=['Float'])
19+
@keyword(types={'argument': 'lOnG'}) # type always given as str
20+
def long_(argument, expected=None):
21+
_validate_type(argument, expected)
22+
23+
24+
@keyword(types={u'argument': u'Float'}) # type given as unicode on Python 2
2025
def float_(argument, expected=None):
2126
_validate_type(argument, expected)
2227

atest/testdata/keywords/type_conversion/annotations_with_aliases.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Force Tags require-py3
1111
Integer
1212
Integer 42 ${42}
1313
Int -1 ${-1}
14-
Integer 9999999999999999999999 ${9999999999999999999999}
14+
Long 9999999999999999999999 ${9999999999999999999999}
1515

1616
Invalid integer
1717
[Template] Conversion Should Fail

atest/testdata/keywords/type_conversion/keyword_decorator_with_aliases.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Resource conversion.resource
1010
Integer
1111
Integer 42 ${42}
1212
Int -1 ${-1}
13-
Integer 9999999999999999999999 ${9999999999999999999999}
13+
Long 9999999999999999999999 ${9999999999999999999999}
1414

1515
Invalid integer
1616
[Template] Conversion Should Fail

doc/userguide/src/ExtendingRobotFramework/CreatingTestLibraries.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,8 +1153,8 @@ case-insensitive.
11531153
| | | | to handle them specially if needed. All comparisons are | |
11541154
| | | | case-insensitive. | |
11551155
+-------------+---------------+------------+----------------------------------------------------------------+--------------------------------------+
1156-
| int_ | Integral_ | integer | Conversion is done using the int_ built-in function. | | `42` |
1157-
| | | | If that fails and type is got implicitly from default values, | | `3.14` (only with implicit type) |
1156+
| int_ | Integral_ | integer, | Conversion is done using the int_ built-in function. | | `42` |
1157+
| | | long | If that fails and type is got implicitly from default values, | | `3.14` (only with implicit type) |
11581158
| | | | also float_ conversion is attempted. | |
11591159
+-------------+---------------+------------+----------------------------------------------------------------+--------------------------------------+
11601160
| float_ | Real_ | double | Conversion is done using the float_ built-in. | | `3.14` |

src/robot/running/arguments/typeconverters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class IntegerConverter(TypeConverter):
142142
type = int
143143
abc = Integral
144144
type_name = 'integer'
145-
aliases = ('int',)
145+
aliases = ('int', 'long')
146146

147147
def _convert(self, value, explicit_type=True):
148148
try:

0 commit comments

Comments
 (0)