DataComparerLibrary 0.854__tar.gz → 0.855__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.854 → datacomparerlibrary-0.855}/PKG-INFO +1 -1
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/pyproject.toml +1 -1
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/datacomparer.py +2 -0
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/datetimehandler.py +15 -17
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/field.py +21 -15
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary.egg-info/PKG-INFO +1 -1
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/LICENSE.txt +0 -0
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/README.rst +0 -0
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/setup.cfg +0 -0
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/__init__.py +0 -0
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/datasorter.py +0 -0
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/delimitertranslator.py +0 -0
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/fileconverter.py +0 -0
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/matchstatus.py +0 -0
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/report.py +0 -0
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/row.py +0 -0
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/tools.py +0 -0
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/twodarray.py +0 -0
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary.egg-info/SOURCES.txt +0 -0
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary.egg-info/dependency_links.txt +0 -0
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary.egg-info/requires.txt +0 -0
- {datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: DataComparerLibrary
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.855
|
|
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
|
|
@@ -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.
|
|
9
|
+
version = "0.855"
|
|
10
10
|
dependencies = ["python-dateutil"]
|
|
11
11
|
authors = [{ name = "René Philip Zuijderduijn", email = "datacomparerlibrary@outlook.com" }]
|
|
12
12
|
readme = "README.rst"
|
{datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/datacomparer.py
RENAMED
|
@@ -87,6 +87,8 @@ class DataComparer:
|
|
|
87
87
|
|
|
88
88
|
@staticmethod
|
|
89
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
|
#
|
{datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/datetimehandler.py
RENAMED
|
@@ -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
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
|
|
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
|
#
|
{datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: DataComparerLibrary
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.855
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/datasorter.py
RENAMED
|
File without changes
|
|
File without changes
|
{datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/fileconverter.py
RENAMED
|
File without changes
|
{datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/matchstatus.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary/twodarray.py
RENAMED
|
File without changes
|
{datacomparerlibrary-0.854 → datacomparerlibrary-0.855}/src/DataComparerLibrary.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|