DataComparerLibrary 0.833__tar.gz → 0.835__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.
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/PKG-INFO +1 -1
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/src/DataComparerLibrary/datacomparer.py +45 -9
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/src/DataComparerLibrary/datasorter.py +1 -1
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/src/DataComparerLibrary/version.py +1 -1
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/src/DataComparerLibrary.egg-info/PKG-INFO +1 -1
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/LICENSE.txt +0 -0
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/README.rst +0 -0
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/pyproject.toml +0 -0
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/setup.cfg +0 -0
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/setup.py +0 -0
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/src/DataComparerLibrary/__init__.py +0 -0
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/src/DataComparerLibrary/delimitertranslator.py +0 -0
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/src/DataComparerLibrary/fileconverter.py +0 -0
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/src/DataComparerLibrary.egg-info/SOURCES.txt +0 -0
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/src/DataComparerLibrary.egg-info/dependency_links.txt +0 -0
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/src/DataComparerLibrary.egg-info/top_level.txt +0 -0
- {DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/test/test1.py +0 -0
{DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/src/DataComparerLibrary/datacomparer.py
RENAMED
|
@@ -136,10 +136,16 @@ class DataComparer:
|
|
|
136
136
|
continue
|
|
137
137
|
#
|
|
138
138
|
if actual_data[row_nr][column_nr] != expected_data_including_templates[row_nr][column_nr]:
|
|
139
|
-
if
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
# Verify if difference is a matter of string versus integer representation.
|
|
140
|
+
if str(actual_data[row_nr][column_nr]) == str(expected_data_including_templates[row_nr][column_nr]):
|
|
141
|
+
if isinstance(actual_data[row_nr][column_nr], int) and isinstance(expected_data_including_templates[row_nr][column_nr], str):
|
|
142
|
+
difference_found = True
|
|
143
|
+
DataComparer.__print_comparation_result(self, row_nr, column_nr, actual_data[row_nr][column_nr], expected_data_including_templates[row_nr][column_nr], "There is a difference between actual and expected data. Actual data is an integer while expected data is a string.")
|
|
144
|
+
elif isinstance(actual_data[row_nr][column_nr], str) and isinstance(expected_data_including_templates[row_nr][column_nr], int):
|
|
145
|
+
difference_found = True
|
|
146
|
+
DataComparer.__print_comparation_result(self, row_nr, column_nr, actual_data[row_nr][column_nr], expected_data_including_templates[row_nr][column_nr], "There is a difference between actual and expected data. Actual data is a string while expected data is an integer.")
|
|
142
147
|
continue
|
|
148
|
+
#
|
|
143
149
|
# If data in actual and expected field doesn't match, check if a template has been used in expected data.
|
|
144
150
|
match expected_data_including_templates[row_nr][column_nr].upper():
|
|
145
151
|
case "{PRESENT}":
|
|
@@ -183,11 +189,13 @@ class DataComparer:
|
|
|
183
189
|
#
|
|
184
190
|
if fnmatch.fnmatch(actual_data[row_nr][column_nr], expected_data_with_wildcard):
|
|
185
191
|
skip_exception_rule_used = True
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
192
|
+
continue
|
|
193
|
+
# This can probably be removed. It is verified further in the code
|
|
194
|
+
# else:
|
|
195
|
+
# # No match despite using of wildcard(s).
|
|
196
|
+
# if "{NOW()" not in expected_data_including_templates[row_nr][column_nr].upper():
|
|
197
|
+
# difference_found = True
|
|
198
|
+
# DataComparer.__print_comparation_result(self, row_nr, column_nr, actual_data[row_nr][column_nr], expected_data_including_templates[row_nr][column_nr], "Actual data field has not been SKIPped.")
|
|
191
199
|
#
|
|
192
200
|
if expected_data_with_wildcard is None:
|
|
193
201
|
# Wildcards not used.
|
|
@@ -196,7 +204,7 @@ class DataComparer:
|
|
|
196
204
|
expected_data_including_date_template = expected_data_with_wildcard
|
|
197
205
|
#
|
|
198
206
|
if "{NOW()" in expected_data_including_templates[row_nr][column_nr].upper():
|
|
199
|
-
matches = ["NOW():", "NOW()+", "{NOW()-"]
|
|
207
|
+
matches = ["{NOW():", "{NOW()+", "{NOW()-"]
|
|
200
208
|
if all([x not in expected_data_including_templates[row_nr][column_nr].upper() for x in matches]):
|
|
201
209
|
difference_found = True
|
|
202
210
|
DataComparer.__print_comparation_result(self, row_nr, column_nr, actual_data[row_nr][column_nr], expected_data_including_templates[row_nr][column_nr], "NOW() has been found in expected data field, but format is incorrect.")
|
|
@@ -213,6 +221,20 @@ class DataComparer:
|
|
|
213
221
|
difference_found = True
|
|
214
222
|
DataComparer.__print_comparation_result(self, row_nr, column_nr, actual_data[row_nr][column_nr], expected_data_including_templates[row_nr][column_nr], "Date template format displayed. See also next message line.")
|
|
215
223
|
DataComparer.__print_comparation_result(self, row_nr, column_nr, actual_data[row_nr][column_nr], expected_data, "There is a difference between actual and expected data.")
|
|
224
|
+
continue
|
|
225
|
+
#
|
|
226
|
+
if "{NOT(" in expected_data_including_templates[row_nr][column_nr].upper():
|
|
227
|
+
unwanted_expected_data = DataComparer.__get_unwanted_expected_data(self, expected_data_including_date_template)
|
|
228
|
+
#
|
|
229
|
+
if unwanted_expected_data == -1:
|
|
230
|
+
difference_found = True
|
|
231
|
+
DataComparer.__print_comparation_result(self, row_nr, column_nr, actual_data[row_nr][column_nr], expected_data_including_templates[row_nr][column_nr], "NOT() has been found in expected data field, but format is incorrect.")
|
|
232
|
+
else:
|
|
233
|
+
if fnmatch.fnmatch(actual_data[row_nr][column_nr], unwanted_expected_data):
|
|
234
|
+
# Unwanted match.
|
|
235
|
+
difference_found = True
|
|
236
|
+
DataComparer.__print_comparation_result(self, row_nr, column_nr, actual_data[row_nr][column_nr], expected_data_including_templates[row_nr][column_nr], "NOT() template format displayed. See also next message line.")
|
|
237
|
+
DataComparer.__print_comparation_result(self, row_nr, column_nr, actual_data[row_nr][column_nr], unwanted_expected_data, "Actual and expected data are equal. However actual data should NOT be equal to the expected data!!!")
|
|
216
238
|
#
|
|
217
239
|
else:
|
|
218
240
|
if not skip_exception_rule_used:
|
|
@@ -348,4 +370,18 @@ class DataComparer:
|
|
|
348
370
|
print("Row: ", row_number + 1, " Column: ", column_number + 1, " => Actual data: ", actual_data, " Expected data: ", expected_data, " Remark / Error message: ", error_message)
|
|
349
371
|
|
|
350
372
|
|
|
373
|
+
def __get_unwanted_expected_data(self, expected_data_field_including_date_template):
|
|
374
|
+
position_open_brace_not_text = expected_data_field_including_date_template.find("{NOT(")
|
|
375
|
+
position_close_brace_not_text = expected_data_field_including_date_template.find(")}", position_open_brace_not_text)
|
|
376
|
+
#
|
|
377
|
+
if position_open_brace_not_text == -1:
|
|
378
|
+
#print("position_open_brace_not_text:", position_open_brace_not_text)
|
|
379
|
+
return -1
|
|
380
|
+
#
|
|
381
|
+
if position_close_brace_not_text == -1:
|
|
382
|
+
#print("position_close_brace_not_text:", position_close_brace_not_text)
|
|
383
|
+
return -1
|
|
384
|
+
#
|
|
385
|
+
unwanted_expected_data = expected_data_field_including_date_template[position_open_brace_not_text+5:position_close_brace_not_text]
|
|
386
|
+
return unwanted_expected_data
|
|
351
387
|
|
{DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/src/DataComparerLibrary/datasorter.py
RENAMED
|
@@ -6,7 +6,7 @@ from DataComparerLibrary.delimitertranslator import DelimiterTranslator
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class DataSorter:
|
|
9
|
-
def
|
|
9
|
+
def sort_csv_file(self, input_file, output_file, number_of_header_lines=0, number_of_trailer_lines=0, sort_on_columns_list=None, delimiter=',', quotechar=None):
|
|
10
10
|
try:
|
|
11
11
|
if not os.path.isfile(input_file):
|
|
12
12
|
raise Exception("Input file doesn't exists: ", input_file)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/src/DataComparerLibrary/fileconverter.py
RENAMED
|
File without changes
|
{DataComparerLibrary-0.833 → DataComparerLibrary-0.835}/src/DataComparerLibrary.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|