DataComparerLibrary 0.854__tar.gz → 0.856__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.
Files changed (22) hide show
  1. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/PKG-INFO +41 -11
  2. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/README.rst +37 -10
  3. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/pyproject.toml +5 -1
  4. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary/__init__.py +0 -3
  5. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary/datacomparer.py +11 -9
  6. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary/datetimehandler.py +15 -17
  7. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary/field.py +21 -15
  8. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary.egg-info/PKG-INFO +41 -11
  9. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/LICENSE.txt +0 -0
  10. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/setup.cfg +0 -0
  11. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary/datasorter.py +0 -0
  12. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary/delimitertranslator.py +0 -0
  13. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary/fileconverter.py +0 -0
  14. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary/matchstatus.py +0 -0
  15. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary/report.py +0 -0
  16. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary/row.py +0 -0
  17. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary/tools.py +0 -0
  18. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary/twodarray.py +0 -0
  19. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary.egg-info/SOURCES.txt +0 -0
  20. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary.egg-info/dependency_links.txt +0 -0
  21. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary.egg-info/requires.txt +0 -0
  22. {datacomparerlibrary-0.854 → datacomparerlibrary-0.856}/src/DataComparerLibrary.egg-info/top_level.txt +0 -0
@@ -1,9 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DataComparerLibrary
3
- Version: 0.854
3
+ Version: 0.856
4
4
  Summary: For comparing csv-files, 2d-array with a csv-file or 2d-arrays. For comparing text-files, text variable with a text-file or text variables. Including a sorting module.
5
5
  Author-email: René Philip Zuijderduijn <datacomparerlibrary@outlook.com>
6
6
  License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/ReneFromHolland/DataComparerLibrary
8
+ Project-URL: Keyword docs, https://github.com/ReneFromHolland/DataComparerLibrary
7
9
  Keywords: robotframework,Robot Framework,testing,test-automation,datacompare,data compare,compare csv files,compare text files,compare txt files,compare arrays,compare text
8
10
  Classifier: Development Status :: 5 - Production/Stable
9
11
  Classifier: Operating System :: Microsoft :: Windows :: Windows 10
@@ -14,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.10
14
16
  Classifier: Programming Language :: Python :: 3.11
15
17
  Classifier: Programming Language :: Python :: 3.12
16
18
  Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
17
20
  Classifier: Topic :: Software Development :: Testing
18
21
  Requires-Python: >=3.8
19
22
  Description-Content-Type: text/x-rst
@@ -29,6 +32,11 @@ DataComparerLibrary
29
32
  :local:
30
33
 
31
34
 
35
+ Documentation
36
+ ===================
37
+ See `keyword documentation`_ for available keywords and more information
38
+ about the library in general.
39
+
32
40
  Preparation
33
41
  ===================
34
42
 
@@ -36,13 +44,17 @@ Installation
36
44
  ------------
37
45
 
38
46
  If you already have Python with `pip <https://pip.pypa.io>`_ installed,
39
- you can simply run::
47
+ you can simply run:
48
+
49
+ .. sourcecode::
40
50
 
41
51
  pip install DataComparerLibrary
42
52
  pip install --upgrade DataComparerLibrary
43
53
 
44
54
 
45
- Also the following pip package is needed::
55
+ Also the following pip package is needed:
56
+
57
+ .. sourcecode::
46
58
 
47
59
  pip install python-dateutil
48
60
 
@@ -50,7 +62,9 @@ Also the following pip package is needed::
50
62
  Import statement for the DataComparerLibrary in Python
51
63
  ------------------------------------------------------
52
64
 
53
- from DataComparerLibrary.datacomparer import DataComparer
65
+ .. sourcecode::
66
+
67
+ from DataComparerLibrary.datacomparer import DataComparer
54
68
 
55
69
 
56
70
 
@@ -66,8 +80,16 @@ The DataComparerLibrary can be used for:
66
80
  - comparing a csv-file or text-file with a 2d-matrix
67
81
  - comparing 2d-matrices
68
82
 
69
- | In case a difference between actual and expected data is found an exception wil be given. In Robot Framework
70
- the result will be set to failed.
83
+ | The DataComparer will present the actual data and the expected data.
84
+ | In case a difference between actual and expected data is found an exception wil be given. Also these differences will be presented.
85
+ | In Robot Framework the comparison result will be set to failed.
86
+ |
87
+
88
+ |
89
+
90
+ Special options
91
+ ---------------
92
+
71
93
  | A strait comparison can be made, but the DataComparerLibrary offers also some special comparison options described
72
94
  beneath.
73
95
  |
@@ -135,8 +157,9 @@ Below there are some examples how to call the methods of the DataComparerLibrary
135
157
  Examples of using the DataComparerLibrary keywords for comparing data in Robot Framework
136
158
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
137
159
 
138
- Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::
160
+ Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework:
139
161
 
162
+ .. sourcecode::
140
163
 
141
164
  *** Settings ***
142
165
  Library DataComparerLibrary
@@ -222,8 +245,9 @@ Comparing Text
222
245
  Examples of using the DataComparerLibrary for comparing text in Python
223
246
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224
247
 
225
- Below there are some examples how to call the methods of the DataComparerLibrary in Python::
248
+ Below there are some examples how to call the methods of the DataComparerLibrary in Python:
226
249
 
250
+ .. sourcecode::
227
251
 
228
252
  a = DataComparer
229
253
  a.compare_text_files(self, actual_file, expected_file)
@@ -235,8 +259,9 @@ Below there are some examples how to call the methods of the DataComparerLibrary
235
259
  Examples of using the DataComparerLibrary keywords for comparing text in Robot Framework
236
260
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
237
261
 
238
- Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::
262
+ Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework:
239
263
 
264
+ .. sourcecode::
240
265
 
241
266
  *** Settings ***
242
267
  Library DataComparerLibrary
@@ -296,8 +321,9 @@ Special sorting
296
321
  Examples of using the DataComparerLibrary keywords for sorting data in Robot Framework
297
322
  ----------------------------------------------------------------------------------------
298
323
 
299
- Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::
324
+ Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework:
300
325
 
326
+ .. sourcecode::
301
327
 
302
328
  *** Settings ***
303
329
  Library DataComparerLibrary
@@ -342,8 +368,9 @@ the input file. The result will be written to an output file.
342
368
  Examples of using the DataComparerLibrary keywords for preparing data in Robot Framework
343
369
  ----------------------------------------------------------------------------------------
344
370
 
345
- Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::
371
+ Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework:
346
372
 
373
+ .. sourcecode::
347
374
 
348
375
  *** Settings ***
349
376
  Library DataComparerLibrary
@@ -365,3 +392,6 @@ Below there are some examples how to call the keywords of the DataComparerLibrar
365
392
  DataComparerLibrary.Replace Separate Lf input_file_with_separate_lf.txt output_file_lf_replaced_by_character_or_string.txt ${SPACE}
366
393
 
367
394
 
395
+
396
+
397
+ .. _Keyword Documentation: https://renefromholland.github.io/DataComparerLibrary/DataComparerLibraryKeywords.html
@@ -6,6 +6,11 @@ DataComparerLibrary
6
6
  :local:
7
7
 
8
8
 
9
+ Documentation
10
+ ===================
11
+ See `keyword documentation`_ for available keywords and more information
12
+ about the library in general.
13
+
9
14
  Preparation
10
15
  ===================
11
16
 
@@ -13,13 +18,17 @@ Installation
13
18
  ------------
14
19
 
15
20
  If you already have Python with `pip <https://pip.pypa.io>`_ installed,
16
- you can simply run::
21
+ you can simply run:
22
+
23
+ .. sourcecode::
17
24
 
18
25
  pip install DataComparerLibrary
19
26
  pip install --upgrade DataComparerLibrary
20
27
 
21
28
 
22
- Also the following pip package is needed::
29
+ Also the following pip package is needed:
30
+
31
+ .. sourcecode::
23
32
 
24
33
  pip install python-dateutil
25
34
 
@@ -27,7 +36,9 @@ Also the following pip package is needed::
27
36
  Import statement for the DataComparerLibrary in Python
28
37
  ------------------------------------------------------
29
38
 
30
- from DataComparerLibrary.datacomparer import DataComparer
39
+ .. sourcecode::
40
+
41
+ from DataComparerLibrary.datacomparer import DataComparer
31
42
 
32
43
 
33
44
 
@@ -43,8 +54,16 @@ The DataComparerLibrary can be used for:
43
54
  - comparing a csv-file or text-file with a 2d-matrix
44
55
  - comparing 2d-matrices
45
56
 
46
- | In case a difference between actual and expected data is found an exception wil be given. In Robot Framework
47
- the result will be set to failed.
57
+ | The DataComparer will present the actual data and the expected data.
58
+ | In case a difference between actual and expected data is found an exception wil be given. Also these differences will be presented.
59
+ | In Robot Framework the comparison result will be set to failed.
60
+ |
61
+
62
+ |
63
+
64
+ Special options
65
+ ---------------
66
+
48
67
  | A strait comparison can be made, but the DataComparerLibrary offers also some special comparison options described
49
68
  beneath.
50
69
  |
@@ -112,8 +131,9 @@ Below there are some examples how to call the methods of the DataComparerLibrary
112
131
  Examples of using the DataComparerLibrary keywords for comparing data in Robot Framework
113
132
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
114
133
 
115
- Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::
134
+ Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework:
116
135
 
136
+ .. sourcecode::
117
137
 
118
138
  *** Settings ***
119
139
  Library DataComparerLibrary
@@ -199,8 +219,9 @@ Comparing Text
199
219
  Examples of using the DataComparerLibrary for comparing text in Python
200
220
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
201
221
 
202
- Below there are some examples how to call the methods of the DataComparerLibrary in Python::
222
+ Below there are some examples how to call the methods of the DataComparerLibrary in Python:
203
223
 
224
+ .. sourcecode::
204
225
 
205
226
  a = DataComparer
206
227
  a.compare_text_files(self, actual_file, expected_file)
@@ -212,8 +233,9 @@ Below there are some examples how to call the methods of the DataComparerLibrary
212
233
  Examples of using the DataComparerLibrary keywords for comparing text in Robot Framework
213
234
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
214
235
 
215
- Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::
236
+ Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework:
216
237
 
238
+ .. sourcecode::
217
239
 
218
240
  *** Settings ***
219
241
  Library DataComparerLibrary
@@ -273,8 +295,9 @@ Special sorting
273
295
  Examples of using the DataComparerLibrary keywords for sorting data in Robot Framework
274
296
  ----------------------------------------------------------------------------------------
275
297
 
276
- Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::
298
+ Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework:
277
299
 
300
+ .. sourcecode::
278
301
 
279
302
  *** Settings ***
280
303
  Library DataComparerLibrary
@@ -319,8 +342,9 @@ the input file. The result will be written to an output file.
319
342
  Examples of using the DataComparerLibrary keywords for preparing data in Robot Framework
320
343
  ----------------------------------------------------------------------------------------
321
344
 
322
- Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::
345
+ Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework:
323
346
 
347
+ .. sourcecode::
324
348
 
325
349
  *** Settings ***
326
350
  Library DataComparerLibrary
@@ -342,3 +366,6 @@ Below there are some examples how to call the keywords of the DataComparerLibrar
342
366
  DataComparerLibrary.Replace Separate Lf input_file_with_separate_lf.txt output_file_lf_replaced_by_character_or_string.txt ${SPACE}
343
367
 
344
368
 
369
+
370
+
371
+ .. _Keyword Documentation: https://renefromholland.github.io/DataComparerLibrary/DataComparerLibraryKeywords.html
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
  [project]
7
7
  name = "DataComparerLibrary"
8
8
  description = "For comparing csv-files, 2d-array with a csv-file or 2d-arrays. For comparing text-files, text variable with a text-file or text variables. Including a sorting module."
9
- version = "0.854"
9
+ version = "0.856"
10
10
  dependencies = ["python-dateutil"]
11
11
  authors = [{ name = "René Philip Zuijderduijn", email = "datacomparerlibrary@outlook.com" }]
12
12
  readme = "README.rst"
@@ -22,12 +22,16 @@ classifiers=[
22
22
  "Programming Language :: Python :: 3.11",
23
23
  "Programming Language :: Python :: 3.12",
24
24
  "Programming Language :: Python :: 3.13",
25
+ "Programming Language :: Python :: 3.14",
25
26
  "Topic :: Software Development :: Testing",
26
27
  ]
27
28
  requires-python = ">=3.8"
28
29
  keywords = ["robotframework", "Robot Framework","testing", "test-automation", "datacompare", "data compare", "compare csv files",
29
30
  "compare text files", "compare txt files", "compare arrays", "compare text"]
30
31
 
32
+ [project.urls]
33
+ "Homepage" = "https://github.com/ReneFromHolland/DataComparerLibrary"
34
+ "Keyword docs" = "https://github.com/ReneFromHolland/DataComparerLibrary"
31
35
 
32
36
  [tool.setuptools]
33
37
  package-dir = { "" = "src" }
@@ -7,6 +7,3 @@ from .fileconverter import FileConverter
7
7
 
8
8
  class DataComparerLibrary(DataComparer, DataSorter, FileConverter):
9
9
  ROBOT_LIBRARY_SCOPE = 'GLOBAL'
10
-
11
-
12
-
@@ -14,7 +14,7 @@ class DataComparer:
14
14
  #
15
15
  expected_data = self.__get_data_from_csv_input_file(expected_file, delimiter_expected_data, quotechar_expected_data)
16
16
  #
17
- DataComparer.compare_data(actual_data, expected_data, template_literals_dict)
17
+ DataComparer.__compare_data(actual_data, expected_data, template_literals_dict)
18
18
 
19
19
 
20
20
  def compare_data_file_with_2d_array(self, actual_file, expected_data, delimiter_actual_data=",", quotechar_actual_data='"', template_literals_dict=None):
@@ -23,14 +23,14 @@ class DataComparer:
23
23
  #
24
24
  actual_data = self.__get_data_from_csv_input_file(actual_file, delimiter_actual_data, quotechar_actual_data)
25
25
  #
26
- DataComparer.compare_data(actual_data, expected_data, template_literals_dict)
26
+ DataComparer.__compare_data(actual_data, expected_data, template_literals_dict)
27
27
 
28
28
 
29
29
  def compare_data_2d_arrays(self, actual_data, expected_data, template_literals_dict=None):
30
30
  self.__check_if_actual_data_is_present(actual_data)
31
31
  self.__check_if_expected_data_is_present(expected_data)
32
32
  #
33
- DataComparer.compare_data(actual_data, expected_data, template_literals_dict)
33
+ DataComparer.__compare_data(actual_data, expected_data, template_literals_dict)
34
34
 
35
35
 
36
36
  def compare_data_files(self, actual_file, expected_file, delimiter_actual_data=",", delimiter_expected_data=",", quotechar_actual_data='"', quotechar_expected_data='"', template_literals_dict=None):
@@ -40,7 +40,7 @@ class DataComparer:
40
40
  actual_data = self.__get_data_from_csv_input_file(actual_file, delimiter_actual_data, quotechar_actual_data)
41
41
  expected_data = self.__get_data_from_csv_input_file(expected_file, delimiter_expected_data, quotechar_expected_data)
42
42
  #
43
- DataComparer.compare_data(actual_data, expected_data, template_literals_dict)
43
+ DataComparer.__compare_data(actual_data, expected_data, template_literals_dict)
44
44
 
45
45
 
46
46
 
@@ -51,7 +51,7 @@ class DataComparer:
51
51
  actual_data = self.__split_text_into_textline_array(actual_text)
52
52
  expected_data = self.__split_textfile_into_textline_array(expected_file)
53
53
  #
54
- DataComparer.compare_data(actual_data, expected_data, template_literals_dict)
54
+ DataComparer.__compare_data(actual_data, expected_data, template_literals_dict)
55
55
 
56
56
 
57
57
  def compare_text_file_with_text_variable(self, actual_file, expected_text, template_literals_dict=None):
@@ -61,7 +61,7 @@ class DataComparer:
61
61
  actual_data = self.__split_textfile_into_textline_array(actual_file)
62
62
  expected_data = self.__split_text_into_textline_array(expected_text)
63
63
  #
64
- DataComparer.compare_data(actual_data, expected_data, template_literals_dict)
64
+ DataComparer.__compare_data(actual_data, expected_data, template_literals_dict)
65
65
 
66
66
 
67
67
  def compare_text_variables(self, actual_text, expected_text, template_literals_dict=None):
@@ -71,7 +71,7 @@ class DataComparer:
71
71
  actual_data = self.__split_text_into_textline_array(actual_text)
72
72
  expected_data = self.__split_text_into_textline_array(expected_text)
73
73
  #
74
- DataComparer.compare_data(actual_data, expected_data, template_literals_dict)
74
+ DataComparer.__compare_data(actual_data, expected_data, template_literals_dict)
75
75
 
76
76
 
77
77
  def compare_text_files(self, actual_file, expected_file, template_literals_dict=None):
@@ -81,12 +81,14 @@ class DataComparer:
81
81
  actual_data = self.__split_textfile_into_textline_array(actual_file)
82
82
  expected_data = self.__split_textfile_into_textline_array(expected_file)
83
83
  #
84
- DataComparer.compare_data(actual_data, expected_data, template_literals_dict)
84
+ DataComparer.__compare_data(actual_data, expected_data, template_literals_dict)
85
85
 
86
86
 
87
87
 
88
88
  @staticmethod
89
- def compare_data(actual_data, expected_data, template_literals_dict=None):
89
+ def __compare_data(actual_data, expected_data, template_literals_dict=None):
90
+ if template_literals_dict is not None and not isinstance(template_literals_dict, dict):
91
+ raise Exception(f"The argument passed to parameter 'template_literals_dict' is not a dictionary. Value is: '{template_literals_dict}'.")
90
92
  actual_data = DataComparer.__make_data_2d_compliant(actual_data)
91
93
  expected_data = DataComparer.__make_data_2d_compliant(expected_data)
92
94
  #
@@ -9,15 +9,15 @@ class DatetimeHandler:
9
9
  position_open_brace_today_text = expected_data_field_including_date_template.find("{NOW()")
10
10
  position_close_brace_today_text = expected_data_field_including_date_template.find("}", position_open_brace_today_text)
11
11
  #
12
+ if position_open_brace_today_text == -1:
13
+ raise Exception("Open brace '{NOW()' not found.")
14
+ #
12
15
  if position_close_brace_today_text == -1:
13
- return -1
14
- # Close brace of TODAY has been found.
16
+ raise Exception("Close brace '}' not found.")
15
17
  #
16
18
  expected_datetime_template_string = expected_data_field_including_date_template[position_open_brace_today_text:position_close_brace_today_text + 1]
17
19
  expected_datetime_string = DatetimeHandler.__convert_datetime_template_to_datetime(self, expected_datetime_template_string)
18
20
  #
19
- if expected_datetime_string == -1:
20
- return -1
21
21
  # Datetime_template_string has been converted to datetime.
22
22
  #
23
23
  # Replace expected_datetime_template_string by expected_datetime_string in expected_data_field_including_template.
@@ -48,18 +48,16 @@ class DatetimeHandler:
48
48
  # Adjust date time based on current date time.
49
49
  relative_datetime_template_string = template_datetime_string_splitted[0].replace('{NOW()', '')
50
50
  relative_datetime = DatetimeHandler.__convert_relative_datetime_template_to_relative_datetime(self, relative_datetime_template_string[1:len(relative_datetime_template_string)])
51
- if relative_datetime == -1:
52
- return -1
53
- else:
54
- match relative_datetime_template_string[0]:
55
- case "+":
56
- expected_datetime = datetime.datetime.now() + relative_datetime
57
- case "-":
58
- expected_datetime = datetime.datetime.now() - relative_datetime
59
- case _:
60
- return -1
51
+ #
52
+ match relative_datetime_template_string[0]:
53
+ case "+":
54
+ expected_datetime = datetime.datetime.now() + relative_datetime
55
+ case "-":
56
+ expected_datetime = datetime.datetime.now() - relative_datetime
57
+ case _:
58
+ raise Exception("'+' or '-' sign not found in '{NOW() relative datetime template string'.")
61
59
  case _:
62
- return -1
60
+ raise Exception("Datetime template format in {NOW() datetime string is incorrect. Split sign ':' to separate expectation and format has been found more than once.")
63
61
  #
64
62
  year = expected_datetime.strftime("%Y")
65
63
  year_2_digits = expected_datetime.strftime("%y")
@@ -80,7 +78,7 @@ class DatetimeHandler:
80
78
  period = regex.match(relative_datetime_str)
81
79
 
82
80
  if not period:
83
- return -1
81
+ raise Exception("Relative datetime template format in '{NOW() datetime template string' " + relative_datetime_str + " is incorrect.")
84
82
 
85
83
  period = period.groupdict()
86
84
  kwargs = {}
@@ -97,4 +95,4 @@ class DatetimeHandler:
97
95
  if kwargs:
98
96
  return dateutil.relativedelta.relativedelta(**kwargs)
99
97
  else:
100
- return -1
98
+ raise Exception("Relative datetime template format in '{NOW() datetime template string' " + relative_datetime_str + " is incorrect.")
@@ -49,9 +49,12 @@ class Field:
49
49
 
50
50
  @staticmethod
51
51
  def __replace_template_literals_dict(data, template_literals_dict):
52
- if template_literals_dict:
53
- for i in range(0, len(template_literals_dict)):
54
- data = data.replace(list(template_literals_dict.keys())[i], str(list(template_literals_dict.values())[i]))
52
+ try:
53
+ if template_literals_dict:
54
+ for i in range(0, len(template_literals_dict)):
55
+ data = data.replace(list(template_literals_dict.keys())[i], str(list(template_literals_dict.values())[i]))
56
+ except Exception as exception_message:
57
+ raise Exception(f"Error during replacing literals. The argument passed to parameter 'template_literals_dict': {template_literals_dict}. Error message: {exception_message}.")
55
58
  return data
56
59
 
57
60
 
@@ -137,20 +140,23 @@ class Field:
137
140
  if all([x not in other_field_data_including_templates.upper() for x in matches]):
138
141
  equal = False
139
142
  Report.show_differences_comparation_result(self.row_nr, self.column_nr, self.field_data, other_field_data_including_templates, "NOW() has been found in expected data field, but format is incorrect.")
140
- #continue
143
+ Report.show_differences_comparation_result(self.row_nr, self.column_nr, self.field_data, other_field_data_including_templates, "Colon character ':', sign '+' or '-'' is missing behind NOW().")
144
+ return False
141
145
  #
142
- expected_data = DatetimeHandler.replace_date_template_in_expected_data(self, expected_data_including_date_template)
143
- #
144
- if expected_data == -1:
145
- equal = False
146
- Report.show_differences_comparation_result(self.row_nr, self.column_nr, self.field_data, other_field_data_including_templates, "NOW() has been found in expected data field, but format is incorrect.")
147
- else:
146
+ try:
147
+ expected_data = DatetimeHandler.replace_date_template_in_expected_data(self, expected_data_including_date_template)
148
+ #
148
149
  if not fnmatch.fnmatch(self.field_data, expected_data):
149
150
  # No match despite using of wildcard(s).
150
151
  equal = False
151
152
  Report.show_differences_comparation_result(self.row_nr, self.column_nr, self.field_data, other_field_data_including_templates, "Date template format displayed. See also next message line.")
152
153
  Report.show_differences_comparation_result(self.row_nr, self.column_nr, self.field_data, expected_data, "There is a difference between actual and expected data.")
153
- # continue
154
+ #
155
+ except Exception as exception_message:
156
+ equal = False
157
+ Report.show_differences_comparation_result(self.row_nr, self.column_nr, self.field_data, other_field_data_including_templates, "NOW() has been found in expected data field, but format is incorrect.")
158
+ Report.show_differences_comparation_result(self.row_nr, self.column_nr, self.field_data, other_field_data_including_templates, exception_message)
159
+
154
160
  #
155
161
  elif "{NOT(" in other_field_data_including_templates.upper():
156
162
  try:
@@ -160,11 +166,11 @@ class Field:
160
166
  # Unwanted match.
161
167
  equal = False
162
168
  Report.show_differences_comparation_result(self.row_nr, self.column_nr, self.field_data, other_field_data_including_templates, "NOT() template format displayed. See also next message line.")
163
- Report.show_differences_comparation_result(self.row_nr, self.column_nr, self.field_data, unwanted_expected_data, "Actual and expected data are equal. However actual data should NOT be equal to the expected data!!!")
169
+ Report.show_differences_comparation_result(self.row_nr, self.column_nr, self.field_data, "<> "+ str(unwanted_expected_data), "Actual and expected data are equal. However actual data should NOT be equal to the expected data!!!")
164
170
  except Exception as exception_message:
165
- # print(f"An exception occurred: {exception_message}")
166
171
  equal = False
167
172
  Report.show_differences_comparation_result(self.row_nr, self.column_nr, self.field_data, other_field_data_including_templates, "NOT() has been found in expected data field, but format is incorrect.")
173
+ Report.show_differences_comparation_result(self.row_nr, self.column_nr, self.field_data, other_field_data_including_templates, exception_message)
168
174
  #
169
175
  else:
170
176
  if not skip_exception_rule_used:
@@ -182,11 +188,11 @@ class Field:
182
188
  #
183
189
  if position_open_brace == -1:
184
190
  #print("position_open_brace:", position_open_brace)
185
- raise Exception()
191
+ raise Exception("Open brace '{NOT(' not found.")
186
192
  #
187
193
  if position_close_brace == -1:
188
194
  #print("position_close_brace:", position_close_brace)
189
- raise Exception()
195
+ raise Exception("Close brace '}' not found.")
190
196
  #
191
197
  unwanted_expected_data = expected_data_field_including_date_template[position_open_brace+5:position_close_brace]
192
198
  #
@@ -1,9 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DataComparerLibrary
3
- Version: 0.854
3
+ Version: 0.856
4
4
  Summary: For comparing csv-files, 2d-array with a csv-file or 2d-arrays. For comparing text-files, text variable with a text-file or text variables. Including a sorting module.
5
5
  Author-email: René Philip Zuijderduijn <datacomparerlibrary@outlook.com>
6
6
  License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/ReneFromHolland/DataComparerLibrary
8
+ Project-URL: Keyword docs, https://github.com/ReneFromHolland/DataComparerLibrary
7
9
  Keywords: robotframework,Robot Framework,testing,test-automation,datacompare,data compare,compare csv files,compare text files,compare txt files,compare arrays,compare text
8
10
  Classifier: Development Status :: 5 - Production/Stable
9
11
  Classifier: Operating System :: Microsoft :: Windows :: Windows 10
@@ -14,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.10
14
16
  Classifier: Programming Language :: Python :: 3.11
15
17
  Classifier: Programming Language :: Python :: 3.12
16
18
  Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
17
20
  Classifier: Topic :: Software Development :: Testing
18
21
  Requires-Python: >=3.8
19
22
  Description-Content-Type: text/x-rst
@@ -29,6 +32,11 @@ DataComparerLibrary
29
32
  :local:
30
33
 
31
34
 
35
+ Documentation
36
+ ===================
37
+ See `keyword documentation`_ for available keywords and more information
38
+ about the library in general.
39
+
32
40
  Preparation
33
41
  ===================
34
42
 
@@ -36,13 +44,17 @@ Installation
36
44
  ------------
37
45
 
38
46
  If you already have Python with `pip <https://pip.pypa.io>`_ installed,
39
- you can simply run::
47
+ you can simply run:
48
+
49
+ .. sourcecode::
40
50
 
41
51
  pip install DataComparerLibrary
42
52
  pip install --upgrade DataComparerLibrary
43
53
 
44
54
 
45
- Also the following pip package is needed::
55
+ Also the following pip package is needed:
56
+
57
+ .. sourcecode::
46
58
 
47
59
  pip install python-dateutil
48
60
 
@@ -50,7 +62,9 @@ Also the following pip package is needed::
50
62
  Import statement for the DataComparerLibrary in Python
51
63
  ------------------------------------------------------
52
64
 
53
- from DataComparerLibrary.datacomparer import DataComparer
65
+ .. sourcecode::
66
+
67
+ from DataComparerLibrary.datacomparer import DataComparer
54
68
 
55
69
 
56
70
 
@@ -66,8 +80,16 @@ The DataComparerLibrary can be used for:
66
80
  - comparing a csv-file or text-file with a 2d-matrix
67
81
  - comparing 2d-matrices
68
82
 
69
- | In case a difference between actual and expected data is found an exception wil be given. In Robot Framework
70
- the result will be set to failed.
83
+ | The DataComparer will present the actual data and the expected data.
84
+ | In case a difference between actual and expected data is found an exception wil be given. Also these differences will be presented.
85
+ | In Robot Framework the comparison result will be set to failed.
86
+ |
87
+
88
+ |
89
+
90
+ Special options
91
+ ---------------
92
+
71
93
  | A strait comparison can be made, but the DataComparerLibrary offers also some special comparison options described
72
94
  beneath.
73
95
  |
@@ -135,8 +157,9 @@ Below there are some examples how to call the methods of the DataComparerLibrary
135
157
  Examples of using the DataComparerLibrary keywords for comparing data in Robot Framework
136
158
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
137
159
 
138
- Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::
160
+ Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework:
139
161
 
162
+ .. sourcecode::
140
163
 
141
164
  *** Settings ***
142
165
  Library DataComparerLibrary
@@ -222,8 +245,9 @@ Comparing Text
222
245
  Examples of using the DataComparerLibrary for comparing text in Python
223
246
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224
247
 
225
- Below there are some examples how to call the methods of the DataComparerLibrary in Python::
248
+ Below there are some examples how to call the methods of the DataComparerLibrary in Python:
226
249
 
250
+ .. sourcecode::
227
251
 
228
252
  a = DataComparer
229
253
  a.compare_text_files(self, actual_file, expected_file)
@@ -235,8 +259,9 @@ Below there are some examples how to call the methods of the DataComparerLibrary
235
259
  Examples of using the DataComparerLibrary keywords for comparing text in Robot Framework
236
260
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
237
261
 
238
- Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::
262
+ Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework:
239
263
 
264
+ .. sourcecode::
240
265
 
241
266
  *** Settings ***
242
267
  Library DataComparerLibrary
@@ -296,8 +321,9 @@ Special sorting
296
321
  Examples of using the DataComparerLibrary keywords for sorting data in Robot Framework
297
322
  ----------------------------------------------------------------------------------------
298
323
 
299
- Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::
324
+ Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework:
300
325
 
326
+ .. sourcecode::
301
327
 
302
328
  *** Settings ***
303
329
  Library DataComparerLibrary
@@ -342,8 +368,9 @@ the input file. The result will be written to an output file.
342
368
  Examples of using the DataComparerLibrary keywords for preparing data in Robot Framework
343
369
  ----------------------------------------------------------------------------------------
344
370
 
345
- Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::
371
+ Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework:
346
372
 
373
+ .. sourcecode::
347
374
 
348
375
  *** Settings ***
349
376
  Library DataComparerLibrary
@@ -365,3 +392,6 @@ Below there are some examples how to call the keywords of the DataComparerLibrar
365
392
  DataComparerLibrary.Replace Separate Lf input_file_with_separate_lf.txt output_file_lf_replaced_by_character_or_string.txt ${SPACE}
366
393
 
367
394
 
395
+
396
+
397
+ .. _Keyword Documentation: https://renefromholland.github.io/DataComparerLibrary/DataComparerLibraryKeywords.html