robotframework-nl 2.2.0__tar.gz → 3.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: robotframework-nl
3
- Version: 2.2.0
3
+ Version: 3.0.0
4
4
  Summary: robotnl is a proving ground to boost Robot framework closer to Natural Language.
5
5
  Author-email: Johan Foederer <github@famfoe.nl>
6
6
  License: BSD 3-Clause License
@@ -41,6 +41,7 @@ Classifier: Operating System :: OS Independent
41
41
  Requires-Python: >=3.8
42
42
  Description-Content-Type: text/markdown
43
43
  License-File: LICENSE
44
+ Requires-Dist: robotframework>=7.0
44
45
 
45
46
  # robotframeworkNL - the oneliner
46
47
  robotframeworkNL is a proving ground to boost Robot framework closer to Natural Language.
@@ -118,7 +119,7 @@ To manually interact with your automated test run during testing or test case de
118
119
  ### Keyword documentation
119
120
 
120
121
  Full documentation of the keywords offered by `robotnl` can be found here:
121
- [Link to keyword documentation](https://github.com/JFoederer/robotframeworkNL/blob/main/robotnl-libdoc.html) (if html does not render, choose *raw* format then right click to *save page as*)
122
+ [Link to keyword documentation](https://jfoederer.github.io/robotframeworkNL/robotnl-libdoc.html)
122
123
 
123
124
  Keyword documentation is in [libdoc](http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#libdoc) format, making it also directly available via intellisense in IDEs, like [RIDE](https://github.com/robotframework/RIDE/wiki).
124
125
 
@@ -74,7 +74,7 @@ To manually interact with your automated test run during testing or test case de
74
74
  ### Keyword documentation
75
75
 
76
76
  Full documentation of the keywords offered by `robotnl` can be found here:
77
- [Link to keyword documentation](https://github.com/JFoederer/robotframeworkNL/blob/main/robotnl-libdoc.html) (if html does not render, choose *raw* format then right click to *save page as*)
77
+ [Link to keyword documentation](https://jfoederer.github.io/robotframeworkNL/robotnl-libdoc.html)
78
78
 
79
79
  Keyword documentation is in [libdoc](http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#libdoc) format, making it also directly available via intellisense in IDEs, like [RIDE](https://github.com/robotframework/RIDE/wiki).
80
80
 
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "robotframework-nl"
10
- version = "2.2.0"
10
+ version = "3.0.0"
11
11
  description = "robotnl is a proving ground to boost Robot framework closer to Natural Language."
12
12
  readme = "README.md"
13
13
  authors = [{ name = "Johan Foederer", email = "github@famfoe.nl" }]
@@ -19,7 +19,7 @@ classifiers = [
19
19
  ]
20
20
  keywords = ["robotframework", "robot", "testing", "dsl"]
21
21
  dependencies = [
22
- "robotframework >= 6.0",
22
+ "robotframework >= 7.0",
23
23
  ]
24
24
  requires-python = ">=3.8"
25
25
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: robotframework-nl
3
- Version: 2.2.0
3
+ Version: 3.0.0
4
4
  Summary: robotnl is a proving ground to boost Robot framework closer to Natural Language.
5
5
  Author-email: Johan Foederer <github@famfoe.nl>
6
6
  License: BSD 3-Clause License
@@ -41,6 +41,7 @@ Classifier: Operating System :: OS Independent
41
41
  Requires-Python: >=3.8
42
42
  Description-Content-Type: text/markdown
43
43
  License-File: LICENSE
44
+ Requires-Dist: robotframework>=7.0
44
45
 
45
46
  # robotframeworkNL - the oneliner
46
47
  robotframeworkNL is a proving ground to boost Robot framework closer to Natural Language.
@@ -118,7 +119,7 @@ To manually interact with your automated test run during testing or test case de
118
119
  ### Keyword documentation
119
120
 
120
121
  Full documentation of the keywords offered by `robotnl` can be found here:
121
- [Link to keyword documentation](https://github.com/JFoederer/robotframeworkNL/blob/main/robotnl-libdoc.html) (if html does not render, choose *raw* format then right click to *save page as*)
122
+ [Link to keyword documentation](https://jfoederer.github.io/robotframeworkNL/robotnl-libdoc.html)
122
123
 
123
124
  Keyword documentation is in [libdoc](http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#libdoc) format, making it also directly available via intellisense in IDEs, like [RIDE](https://github.com/robotframework/RIDE/wiki).
124
125
 
@@ -0,0 +1 @@
1
+ robotframework>=7.0
@@ -30,6 +30,7 @@
30
30
  # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
31
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
32
 
33
+ from robot.api import TypeInfo
33
34
  from robot.libraries.BuiltIn import BuiltIn
34
35
  from robot.running.arguments import TypeConverter
35
36
 
@@ -128,8 +129,8 @@ class CheckOperator:
128
129
  Iterates over the sequence to apply automatic Robot type conversion where applicable.
129
130
  """
130
131
  for item in sequence:
131
- BuiltIn().log("Processing '%s' from list" % item)
132
- if self.is_equal_to(part, item):
132
+ BuiltIn().log(f"Processing '{item}' from list")
133
+ if self.equals(part, item):
133
134
  BuiltIn().log("Matched")
134
135
  return True
135
136
  BuiltIn().log("No match")
@@ -140,19 +141,22 @@ class CheckOperator:
140
141
  Checks whether the sequence on the right side contains all items of the left side and vice versa.
141
142
  Iterates over sequence on the left and matches each element with a single element on the right.
142
143
  """
144
+ if isinstance(sequence_right, str):
145
+ sequence_right = [sequence_right]
146
+ sequence_right = [*sequence_right]
143
147
  for item in sequence:
144
148
  item_found_in_parts = False
145
- BuiltIn().log("Processing '%s' from list" % item)
149
+ BuiltIn().log(f"Processing '{item}' from left side list")
146
150
  for i in range(len(sequence_right)):
147
- if self.equals(sequence_right[i],item):
151
+ if self.equals(item, sequence_right[i]):
148
152
  sequence_right.pop(i)
149
153
  item_found_in_parts = True
150
154
  break
151
155
  if not item_found_in_parts:
152
- BuiltIn().log("Item '%s' from left side is not found in the list on the right side" % item)
156
+ BuiltIn().log(f"Item '{item}' from left side is not found in the list on the right side")
153
157
  return False
154
158
  if len(sequence_right) > 0:
155
- BuiltIn().log("Not all items from right side list are present: %s" % sequence_right)
159
+ BuiltIn().log(f"Not all items from right side list are present: {sequence_right}")
156
160
  return False
157
161
 
158
162
  return True
@@ -192,10 +196,10 @@ class OperatorProxy:
192
196
  returns type casted otherValue
193
197
  """
194
198
  CastedOther = otherValue # By default leave untouched
195
- converter = TypeConverter.converter_for(type(leadingValue))
199
+ converter = TypeConverter.converter_for(TypeInfo.from_type(type(leadingValue)))
196
200
  if converter:
197
201
  try:
198
- CastedOther = converter.convert(name, otherValue, explicit_type=False)
202
+ CastedOther = converter.convert(otherValue, name)
199
203
  except ValueError as err:
200
204
  BuiltIn().log(err, level='DEBUG')
201
205
  BuiltIn().log(f"Comparing as {converter.type_name} values")
@@ -105,7 +105,7 @@ class RobotChecks:
105
105
  Check that has two basic forms.
106
106
  - A single keyword (with its arguments) can be evaluated to a truth value
107
107
  - Two values or keywords (with their arguments) can be evaluated using an operator. It will
108
- then have the form Check that < ``keyword or value`` > < ``operator`` > < ``keyword or value`` >.
108
+ then have the form Check that ``<keyword or value>`` ``<operator>`` ``<keyword or value>``.
109
109
 
110
110
  Operator can be any Robot keyword taking exactly two values (left and right operands) as
111
111
  input. A number of predefined operators on numeric, string and list types are included in
@@ -118,8 +118,8 @@ class RobotChecks:
118
118
  | `Check that` | Earth exists |
119
119
 
120
120
  'Two times' in these examples is assumed to be defined as a Robot keyword that takes one
121
- argument and multiplies it by 2. Check that will pass if the evaluated result of Two times 9
122
- equals the fixed expected value 18.
121
+ argument and multiplies it by 2. Check that will pass if the evaluated result of Two times 6
122
+ equals the fixed expected value 12.
123
123
 
124
124
  *Adding time constraints*:\n
125
125
  Any check can be extended with an additional timing constraint by adding ``within``
@@ -32,8 +32,7 @@
32
32
 
33
33
  from robot.libraries.BuiltIn import BuiltIn
34
34
  from robot.api.deco import keyword as robot_keyword
35
- from robot.api import logger
36
- from robot.utils import type_repr
35
+ from robot.utils import type_name
37
36
  from robot.running.arguments import TypeConverter
38
37
 
39
38
  from functools import wraps
@@ -81,7 +80,6 @@ class InlineKeyword(Generic[TypeVar('T')]):
81
80
  Inline keywords are keywords that are used as argument to other keywords. The keyword will be
82
81
  evaluated and its return value used as the actual argument.
83
82
  """
84
- _name = 'inline keyword'
85
83
 
86
84
 
87
85
  # work around for Libdoc
@@ -97,24 +95,21 @@ class InlineKeywordConverter(TypeConverter):
97
95
  type = InlineKeyword
98
96
  type_name = 'InlineKeyword'
99
97
 
100
- def __init__(self, used_type, custom_converters=None, languages=None):
101
- super().__init__(used_type, custom_converters, languages)
102
- types = self._get_nested_types(used_type, expected_count=1)
103
- if not types:
104
- self.converter = None
105
- else:
106
- self.type_name = type_repr(used_type)
107
- self.converter = self.converter_for(types[0], custom_converters, languages)
98
+ def __init__(self, type_info, custom_converters=None, languages=None):
99
+ super().__init__(type_info, custom_converters, languages)
100
+ self.converter = self.converter_for(self.type_info.nested[0])
101
+ self.type_name = f"keyword returning {type_name(self.type_info.nested[0].type)}"
108
102
 
109
- def _convert(self, value, explicit_type=True):
103
+ def _convert(self, value):
110
104
  if not is_keyword(value):
111
105
  raise ValueError
112
106
  BuiltIn().log(f"Evaluating argument as keyword [{value}]")
113
107
  result = BuiltIn().run_keyword(value)
114
108
  BuiltIn().log(f"{value} → {result}")
115
109
  if self.converter:
110
+ # Convert the return type of the keyword to the expected type
116
111
  try:
117
- result = self.converter.convert(f"result of: {value}", result, explicit_type)
112
+ result = self.converter.convert(result, f"result of: {value}")
118
113
  except ValueError as err:
119
114
  BuiltIn().log(f"Incorrect keyword return type: {err}")
120
115
  raise
@@ -0,0 +1 @@
1
+ VERSION = '3.0.0'
@@ -1 +0,0 @@
1
- robotframework>=6.0
@@ -1 +0,0 @@
1
- VERSION = '2.2.0'