Skip to content

Commit 1c4c5d6

Browse files
pekkaklarckyanne
authored andcommitted
Fix Import Library with WITH NAME containing non-ASCII spaces robotframework#3121
1 parent b8ca00a commit 1c4c5d6

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

atest/robot/standard_libraries/builtin/import_library.robot

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ Import Library With Arguments
1414
Import Library With Variables And WITH NAME
1515
Check Test Case ${TEST NAME}
1616

17+
Import Library With WITH NAME containing non-ASCII spaces
18+
Check Test Case ${TEST NAME}
19+
1720
Import Library Using Physical Path
1821
Check Test Case ${TEST NAME}
1922

atest/testdata/standard_libraries/builtin/import_library.robot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ Import Library With Variables And WITH NAME
2121
Import Library ${name} ${42} ${name} WITH NAME Variables-${42}
2222
Variables-42.Parameters Should Be ${42} ParameterLibrary
2323

24+
Import Library With WITH NAME containing non-ASCII spaces
25+
${name} = Set Variable ParameterLibrary
26+
Import Library ${name} Ogham space mark : : WITH NAME Ogham space mark
27+
Ogham space mark.Parameters Should Be Ogham space mark : :
28+
2429
Import Library Using Physical Path
2530
Import Library ${CURDIR}${/}RegisteredClass.py
2631
RegisteredClass. Run Keyword If Method False Fail This is not executed

src/robot/libraries/BuiltIn.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@
2727
from robot.running.context import EXECUTION_CONTEXTS
2828
from robot.running.usererrorhandler import UserErrorHandler
2929
from robot.utils import (DotDict, escape, format_assign_message,
30-
get_error_message, get_time, html_escape, is_falsy, is_integer,
31-
is_string, is_truthy, is_unicode, IRONPYTHON, JYTHON,
32-
Matcher, normalize, NormalizedDict, parse_time, prepr,
33-
plural_or_not as s, PY3, RERAISED_EXCEPTIONS, roundup,
34-
secs_to_timestr, seq2str, split_from_equals, StringIO,
35-
timestr_to_secs, type_name, unic, is_list_like)
30+
get_error_message, get_time, html_escape, is_falsy,
31+
is_integer, is_list_like, is_string, is_truthy,
32+
is_unicode, IRONPYTHON, JYTHON, Matcher, normalize,
33+
normalize_whitespace, NormalizedDict, parse_time,
34+
prepr, plural_or_not as s, PY3, RERAISED_EXCEPTIONS,
35+
roundup, secs_to_timestr, seq2str, split_from_equals,
36+
StringIO, timestr_to_secs, type_name, unic)
3637
from robot.utils.asserts import assert_equal, assert_not_equal
3738
from robot.variables import (is_list_var, is_var, DictVariableTableValue,
3839
VariableTableValue, VariableSplitter,
@@ -2767,7 +2768,7 @@ def import_library(self, name, *args):
27672768
raise RuntimeError(unic(err))
27682769

27692770
def _split_alias(self, args):
2770-
if len(args) > 1 and args[-2] == 'WITH NAME':
2771+
if len(args) > 1 and normalize_whitespace(args[-2]) == 'WITH NAME':
27712772
return args[:-2], args[-1]
27722773
return args, None
27732774

0 commit comments

Comments
 (0)