Thanks to visit codestin.com
Credit goes to github.com

Skip to content

First 2 keywords for case-insensitive string comparison #2447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9f1490e
#2437 Options' default value of RobotSettings and RebotSettings shoul…
krizex Aug 31, 2016
3edb9ea
Added the input parameters and logic to have "Should Be Equal"/"As St…
chriscallan Sep 22, 2016
f662c68
Added the input parameters and logic to have "Should Be Equal"/"As St…
Sep 22, 2016
ff5d372
Fix updated note in UG
pekkaklarck Sep 22, 2016
654572b
Merge branch 'master' of https://github.com/krizex/robotframework int…
pekkaklarck Sep 22, 2016
aa8be6c
Cleaned up unit tests for handling state between runs
pekkaklarck Sep 22, 2016
c45a051
Small cleanup and added utest for handling settings between runs.
pekkaklarck Sep 22, 2016
ff0d0a1
Libdoc: Syntax highlighting when using reST. #2448
pekkaklarck Sep 23, 2016
ef94cb1
ug2html.py: Require new enough Pygments version.
pekkaklarck Sep 23, 2016
54df5e0
Modified the logic for some of the keywords to utilize internal varia…
chriscallan Sep 23, 2016
87297c2
#2437 Options' default value of RobotSettings and RebotSettings shoul…
krizex Aug 31, 2016
c5a1f2f
Fix updated note in UG
pekkaklarck Sep 22, 2016
ba8a32a
Cleaned up unit tests for handling state between runs
pekkaklarck Sep 22, 2016
2a16a90
Small cleanup and added utest for handling settings between runs.
pekkaklarck Sep 22, 2016
6185473
Libdoc: Syntax highlighting when using reST. #2448
pekkaklarck Sep 23, 2016
4e63a85
ug2html.py: Require new enough Pygments version.
pekkaklarck Sep 23, 2016
7677df1
Added the input parameters and logic to have "Should Be Equal"/"As St…
chriscallan Sep 22, 2016
57fde72
Modified the logic for some of the keywords to utilize internal varia…
chriscallan Sep 23, 2016
0610eb7
Merge branch 'CaseInsensitive' of github.com:chriscallan/robotframewo…
chriscallan Sep 23, 2016
d9eedaa
Added the input parameters and logic to have "Should Be Equal"/"As St…
chriscallan Sep 22, 2016
26539e4
Modified the logic for some of the keywords to utilize internal varia…
chriscallan Sep 23, 2016
988fdee
Added the input parameters and logic to have "Should Be Equal"/"As St…
chriscallan Sep 22, 2016
b4cf7e1
Modified the logic for some of the keywords to utilize internal varia…
chriscallan Sep 23, 2016
966d672
Merge branch 'master' into CaseInsensitive
chriscallan Sep 23, 2016
338259c
Merge branch 'CaseInsensitive'
chriscallan Sep 23, 2016
7d00973
Added test case for "Should Be Equal" that exercises case insensitivity;
chriscallan Sep 23, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions atest/robot/standard_libraries/builtin/verify.robot
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Should Not Be Equal
Verify argument type message ${tc.kws[1].msgs[0]} unicode int
Verify argument type message ${tc.kws[2].msgs[0]} unicode unicode

Should Not Be Equal With Case Insensitivity
Check Test Case ${TESTNAME}

Should Not Be Equal with bytes containing non-ascii characters
${tc}= Check test case ${TESTNAME}
Verify argument type message ${tc.kws[0].msgs[0]} str str
Expand All @@ -46,6 +49,9 @@ Should Be Equal
Verify argument type message ${tc.kws[2].msgs[0]} str str
Verify argument type message ${tc.kws[3].msgs[0]} unicode unicode

Should Be Equal With Case Insensitivity
Check Test Case ${TESTNAME}

Should Be Equal fails with values
Check test case ${TESTNAME}

Expand Down Expand Up @@ -114,20 +120,33 @@ Should Not Be Equal As Strings
${tc}= Check test case ${TESTNAME}
Verify argument type message ${tc.kws[0].msgs[0]} unicode float

Should Not Be Equal As Strings With Case Insensitivity
Check Test Case ${TESTNAME}

Should Be Equal As Strings
${tc}= Check test case ${TESTNAME}
Verify argument type message ${tc.kws[0].msgs[0]} int unicode

Should Be Equal As Strings With Case Insensitivity
Check Test Case ${TESTNAME}

Should Be Equal As Strings Multiline
[Tags] no-python26 # diff contains extra spaces on python 2.6
Check test case ${TESTNAME}

Should Not Start With
Check test case ${TESTNAME}

Should Not Start With Case Insensitive
[Tags] ShouldNot
Check Test Case ${TESTNAME}

Should Start With
Check test case ${TESTNAME}

Should Start With Case Insensitive
Check Test Case ${TESTNAME}

Should Start With without values
Check test case ${TESTNAME}

Expand All @@ -137,27 +156,45 @@ Should Not End With
Should End With
Check test case ${TESTNAME}

Should Not End With Case Insensitive
Check Test Case ${TESTNAME}

Should End With Case Insensitive
Check Test Case ${TESTNAME}

Should End With without values
Check test case ${TESTNAME}

Should Not Contain
Check test case ${TESTNAME}

Should Not Contain With Case Insensitivity
Check Test Case ${TESTNAME}

Should Not Contain With Non-String Values
Check test case ${TESTNAME}

Should Contain
Check test case ${TESTNAME}

Should Contain With Case Insensitivity
Check Test Case ${TESTNAME}

Should Contain With Non-String Values
Check test case ${TESTNAME}

Should Not Match
Check test case ${TESTNAME}

Should Not Match With Case Insensitivity
Check Test Case ${TESTNAME}

Should Match
Check test case ${TESTNAME}

Should Match With Case Insensitivity
Check Test Case ${TESTNAME}

Should Match with bytes containing non-ascii characters
Check test case ${TESTNAME}

Expand Down Expand Up @@ -227,6 +264,9 @@ Should Contain X Times With String
Check Log Message ${tc.kws[1].msgs[0]} Item found from the first item 1 time
Check Log Message ${tc.kws[3].msgs[0]} Item found from the first item 0 times

Should Contain X Times With Case Insensitivity
Check Test Case ${TESTNAME}

Should Contain X Times With List
${tc} = Check test case ${TESTNAME}
Check Log Message ${tc.kws[0].msgs[0]} Item found from the first item 1 time
Expand Down
2 changes: 1 addition & 1 deletion atest/testdata/cli/dryrun/args.robot
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Valid positional args
Normal and varargs and kwargs 1 2 3 4

Too few arguments
[Documentation] FAIL Keyword 'BuiltIn.Should Be Equal' expected 2 to 4 arguments, got 1.
[Documentation] FAIL Keyword 'BuiltIn.Should Be Equal' expected 2 to 5 arguments, got 1.
Should Be Equal 1

Too few arguments for UK
Expand Down
2 changes: 1 addition & 1 deletion atest/testdata/cli/dryrun/dryrun.robot
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Invalid syntax in UK

Multiple Failures
[Documentation] FAIL Several failures occurred:\n\n
... 1) Keyword 'BuiltIn.Should Be Equal' expected 2 to 4 arguments, got 1.\n\n
... 1) Keyword 'BuiltIn.Should Be Equal' expected 2 to 5 arguments, got 1.\n\n
... 2) Invalid argument specification: Invalid argument syntax '${arg'.\n\n
... 3) Keyword 'BuiltIn.Log' expected 1 to 5 arguments, got 6.\n\n
... 4) No keyword with name 'Yet another non-existing keyword' found.\n\n
Expand Down
4 changes: 2 additions & 2 deletions atest/testdata/running/test_template.robot
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ Templated test with for loop continues after keyword timeout
\ ${sleep}s ${timeout}s

Templated test ends after syntax errors
[Documentation] FAIL Keyword 'BuiltIn.Should Be Equal' expected 2 to 4 arguments, got 5.
Syntax error makes test end
[Documentation] FAIL Keyword 'BuiltIn.Should Be Equal' expected 2 to 5 arguments, got 6.
Syntax error makes test end early
Not compared anymore

Templated test continues after variable error
Expand Down
79 changes: 79 additions & 0 deletions atest/testdata/standard_libraries/builtin/verify.robot
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,21 @@ Should Not Be Equal
${STR1} ${INT1}
${STR1} 1

Should Not Be Equal With Case Insensitivity
[Template] Should Not Be Equal
test value TEST VALUE1 ignore_case=True
HYVÄÄ YÖTÄ hyvää yötä1 ignore_case=True

Should Not Be Equal with bytes containing non-ascii characters
[Documentation] FAIL ${BYTES WITH NON ASCII} == ${BYTES WITH NON ASCII}
Should Not Be Equal ${BYTES WITH NON ASCII} ${BYTES WITHOUT NON ASCII}
Should Not Be Equal ${BYTES WITH NON ASCII} unicode
Should Not Be Equal ${BYTES WITH NON ASCII} ${BYTES WITH NON ASCII}

Should Be Equal With Case Insensitivity
Should Be Equal "test value" "TEST VALUE" ignore_case=True
Should Be Equal As Strings "test value" "TEST VALUE" ignore_case=True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Quotes in the verified text are not necessary and mainly confuse reader.
  • I'd prefer having case-insensitive test after normal Should Be Equal test.
  • Should test also with non-ASCII characters. For example that HYVÄÄ YÖTÄ (good night in Finnish) equals hyvää yötä case-insensitively. Could consider using [Template] like many other tests here.
  • Should Be Equal As Strings should get its own test after normal Should Be Equal As Strings test.


Should Be Equal
[Documentation] FAIL Error message: A != B
[Template] Should Be Equal
Expand All @@ -82,6 +91,11 @@ Should Be Equal
${BYTES WITHOUT NON ASCII} ${BYTES WITHOUT NON ASCII}
A B Error message values=yes

Should Be Equal With Case Insensitivity
[Template] Should Be Equal
test value TEST VALUE ignore_case=True
HYVÄÄ YÖTÄ hyvää yötä ignore_case=True

Should Be Equal fails with values
[Documentation] FAIL Several failures occurred:\n\n 1) 3: 1 != 2\n\n 2) c: a != b\n\n 3) z: x != y
[Template] Should Be Equal
Expand Down Expand Up @@ -211,13 +225,23 @@ Should Not Be Equal As Strings
False ${True}
bar bar These strings most certainly should not be equal False

Should Not Be Equal As Strings With Case Insensitivity
[Template] should not be equal as strings
test value TEST VALUE1 ignore_case=True
HYVÄÄ YÖTÄ hyvää yötä1 ignore_case=True

Should Be Equal As Strings
[Documentation] FAIL foo != bar
[Template] Should Be Equal As Strings
${1} 1
${None} None
foo bar

Should Be Equal As Strings With Case Insensitivity
[Template] should be equal as strings
test value TEST VALUE ignore_case=True
HYVÄÄ YÖTÄ hyvää yötä ignore_case=True

Should Be Equal As Strings Multiline
[Documentation] FAIL Multiline strings are different:
... --- first
Expand All @@ -236,13 +260,24 @@ Should Not Start With
Hello, world! HELLO
Hello, world! Hello

Should Not Start With Case Insensitive
[Documentation] FAIL 'Hello, world!' starts with 'HELLO'
[Template] Should Not Start With
Hello, world! Hi ignore_case=True
Hello, world! HELLO ignore_case=True

Should Start With
[Documentation] FAIL My message: '${LONG}' does not start with 'Does not start'
[Template] Should Start With
Hello, world! Hello
Hello, world! Hello, world!
${LONG} Does not start My message values=true

Should Start With Case Insensitive
[Template] Should Start With
Hello, world! HELLO ignore_case=True
HYVÄÄ YÖTÄ hyvää ignore_case=True

Should Start With without values
[Documentation] FAIL My message
Should Start With ${LONG} Nope My message values=No values
Expand All @@ -253,6 +288,12 @@ Should Not End With
Hello! Hello
Hillo! ! Message only No Values

Should Not End With Case Insensitive
[Template] Should Not End With
Hello! Hello
test value VALU ignore_case=True
HYVÄÄ YÖTÄ hyvää ignore_case=True

Should End With without values
[Documentation] FAIL My message
Should End With ${LONG} Nope My message values=No values
Expand All @@ -264,12 +305,26 @@ Should End With
Hello, world! Hello, world!
Hello, world! ?

Should End With Case Insensitive
[Template] Should End With
test value VALUE ignore_case=True
Hello, world! WORLD! ignore_case=True
HYVÄÄ YÖTÄ yötä ignore_case=True

Should Not Contain
[Documentation] FAIL 'Hello yet again' contains 'yet'
[Template] Should Not Contain
Hello again yet
Hello yet again yet

Should Not Contain With Case Insensitivity
[Documentation] FAIL 'Hello yet again' contains 'YET'
[Template] Should Not Contain
Hello again yet ignore_case=True
test value VALUE1 ignore_case=True
HYVÄÄ YÖTÄ hyvää1 ignore_case=True
Hello yet again YET ignore_case=True

Should Not Contain With Non-String Values
[Documentation] FAIL '(1, 2)' contains '1'
${list} ${tuple} ${dict} = Evaluate ['a'], (1,2), {'a':1, 'b':2}
Expand All @@ -285,6 +340,11 @@ Should Contain
abcdefg abcdefg Massage
abcdefg ABCDEFG Message

Should Contain With Case Insensitivity
[Template] Should Contain
testvalue ES ignore_case=True
HYVÄÄYÖTÄ ää ignore_case=True

Should Contain With Non-String Values
[Documentation] FAIL '{'a': 1}' does not contain 'c'
${list} ${tuple} ${dict} = Evaluate ['a'], (1,2), {'a':1}
Expand All @@ -299,11 +359,24 @@ Should Not Match
Should Not Match Case matters case matters
Should Not Match Hello world ?ello*

Should Not Match With Case Insensitivity
[Documentation] FAIL 'Hello world' matches '?ELLO*'
[Template] Should Not Match
this string does not match this pattern ignore_case=True
Case does not matter case does not matters ignore_case=True
Hello world ?ELLO* ignore_case=True

Should Match
[Documentation] FAIL Failure: 'NOK' does not match 'OK'
Should Match abcdefghijklmnopqrstuvwxyz ?*?efg*p*t?vw*z
Should Match NOK OK Failure

Should Match With Case Insensitivity
[Template] Should Match
abcdefghijklmnopqrstuvwxyz ?*?EFG*P*T?VW*Z ignore_case=True
test value TEST?*?UE ignore_case=True
HYVÄÄ YÖTÄ HYV?ä *tä ignore_case=True

Should Match with bytes containing non-ascii characters
[Documentation] FAIL '${BYTES WITH NON ASCII}' does not match 'aaappaa'
Should match ${BYTES WITH NON ASCII} aaappaa
Expand Down Expand Up @@ -426,6 +499,12 @@ Should Contain X Times With String
Should Contain X Times hello hello 1
Should Contain X Times hello x 0

Should Contain X Times With Case Insensitivity
Should Contain X Times hello L 2 ignore_case=True
Should Contain X Times hello ELLO 1 ignore_case=True
Should Contain X Times hello HELLO 1 ignore_case=True
Should Contain X Times hello X 0 ignore_case=True

Should Contain X Times With List
Should Contain X Times ${LIST} cee 1
Should Contain X Times ${LIST} b 2
Expand Down
4 changes: 2 additions & 2 deletions doc/userguide/src/ExecutingTestCases/ConfiguringExecution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ is same as not specifying this option at all.
using the :option:`--merge` command line option.

.. note:: Re-executing failed tests is a new feature in Robot Framework 2.8.
Prior Robot Framework 2.8.4 the option was named :option:`--runfailed`.
The old name still works, but it will be removed in the future.
Prior to Robot Framework 2.8.4 the option was named
:option:`--runfailed`.

__ `Merging outputs`_

Expand Down
26 changes: 11 additions & 15 deletions doc/userguide/ug2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,22 @@
from docutils import nodes
from docutils.parsers.rst import directives

from pygments import highlight
from pygments.lexers import get_lexer_by_name, TextLexer
from pygments import highlight, __version__ as pygments_version
from pygments.lexers import get_lexer_by_name


pygments_version = tuple(int(v) for v in pygments_version.split('.')[:2])
if pygments_version < (2, 1):
sys.exit('Pygments version 2.1 or newer is required.')


def pygments_directive(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
try:
if arguments[0] == 'robotframework':
try:
from robotframeworklexer import RobotFrameworkLexer
lexer = RobotFrameworkLexer()
except ImportError:
sys.exit('RobotFrameworkLexer needed for syntax highlighting '
'until Pygments version with RF 2.9 syntax is released.\n\n'
'\tpip install -U robotframeworklexer')
else:
lexer = get_lexer_by_name(arguments[0])
except ValueError:
# no lexer found - use the text one instead of an exception
lexer = TextLexer()
lexer = get_lexer_by_name(arguments[0])
except ValueError as err:
raise ValueError('Invalid syntax highlighting language "%s".'
% arguments[0])
# take an arbitrary option if more than one is given
formatter = options and VARIANTS[options.keys()[0]] or DEFAULT
# possibility to read the content from an external file
Expand Down
5 changes: 3 additions & 2 deletions src/robot/conf/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ def __init__(self, options=None, **extra_options):
def _process_cli_opts(self, opts):
for name, (cli_name, default) in self._cli_opts.items():
value = opts[cli_name] if cli_name in opts else default
if default == [] and not is_list_like(value):
value = [value]
if isinstance(default, list):
# Copy mutable values and support list values as scalars.
value = list(value) if is_list_like(value) else [value]
self[name] = self._process_value(name, value)
self['TestNames'] += self['ReRunFailed']

Expand Down
2 changes: 1 addition & 1 deletion src/robot/htmldata/common/doc_formatting.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
.doc pre {
font-size: 1.1em;
letter-spacing: 0.05em;
background: #eee;
background: #f4f4f4;
}
.doc code {
padding: 0 0.2em;
Expand Down
1 change: 1 addition & 0 deletions src/robot/htmldata/libdoc/libdoc.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<meta name="Generator" content="">
<link rel="icon" type="image/x-icon" href="data:image/x-icon;base64,AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAAAIAAAAAAAAAAAAAEAAAAAAAAAAAAAAAJEBoACtnfgA5cYYAERsiAEx2lAAbKkQAcazBACZCVwAcM1cAK0ucAAMDBQAnQncASG+FABkoVQAyWmgA6f8SgvH/Ij99+GLyIinyJfn/Yi//KSLzUy9iZogpIld3/4JVVTkid7vyUjNVNVJEAGOZ6Z7pXwAABpmZkRiLAAAGiJZpmGAAAEEt3SXdxAAATC7o/u3EAAC8MRZpjasAAAY1VVVTYAAABKqqqqpAAAAADKqq4AAAAAAAv4sAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMADAADgAwAA4AcAAOAHAADgBwAAwAcAAOAHAADgDwAA8A8AAPg/AAD+fwAA">
<link rel="stylesheet" type="text/css" href="libdoc.css" media="all">
<link rel="stylesheet" type="text/css" href="pygments.css" media="all">
<link rel="stylesheet" type="text/css" href="print.css" media="print">
<link rel="stylesheet" type="text/css" href="../common/js_disabled.css" media="all">
<link rel="stylesheet" type="text/css" href="../common/doc_formatting.css" media="all">
Expand Down
Loading