DataComparerLibrary 0.841__tar.gz → 0.843__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.841 → datacomparerlibrary-0.843}/PKG-INFO +1 -1
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/src/DataComparerLibrary/datacomparer.py +84 -0
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/src/DataComparerLibrary/version.py +1 -1
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/src/DataComparerLibrary.egg-info/PKG-INFO +1 -1
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/LICENSE.txt +0 -0
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/README.rst +0 -0
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/pyproject.toml +0 -0
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/setup.cfg +0 -0
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/setup.py +0 -0
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/src/DataComparerLibrary/__init__.py +0 -0
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/src/DataComparerLibrary/datasorter.py +0 -0
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/src/DataComparerLibrary/delimitertranslator.py +0 -0
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/src/DataComparerLibrary/fileconverter.py +0 -0
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/src/DataComparerLibrary/tools.py +0 -0
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/src/DataComparerLibrary.egg-info/SOURCES.txt +0 -0
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/src/DataComparerLibrary.egg-info/dependency_links.txt +0 -0
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/src/DataComparerLibrary.egg-info/top_level.txt +0 -0
- {datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/test/test1.py +0 -0
{datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/src/DataComparerLibrary/datacomparer.py
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# Script for comparing actual data from an output file or a SQL-query with expected data in a file.
|
|
2
2
|
#
|
|
3
|
+
from array import *
|
|
3
4
|
import csv
|
|
4
5
|
import datetime
|
|
5
6
|
import fnmatch
|
|
@@ -85,6 +86,88 @@ class DataComparer:
|
|
|
85
86
|
DataComparer.__compare_data(self, actual_data, expected_data)
|
|
86
87
|
|
|
87
88
|
|
|
89
|
+
def compare_text_variable_with_text_file(self, actual_text, expected_file):
|
|
90
|
+
if 'actual_data' not in locals():
|
|
91
|
+
raise Exception("Input Actual data unknown.")
|
|
92
|
+
#
|
|
93
|
+
if not os.path.exists(expected_file):
|
|
94
|
+
raise Exception("Input file doesn't exists: ", expected_file)
|
|
95
|
+
#
|
|
96
|
+
print("expected_file: ", expected_file)
|
|
97
|
+
#
|
|
98
|
+
actual_data = []
|
|
99
|
+
for line in actual_text.split('\n'):
|
|
100
|
+
actual_data.append(line.strip('\n').split(chr(255)))
|
|
101
|
+
#
|
|
102
|
+
with open(expected_file, mode='rt', encoding='utf-8') as expected_file:
|
|
103
|
+
expected_data = []
|
|
104
|
+
for line in expected_file.readlines():
|
|
105
|
+
expected_data.append(line.strip('\n').split(chr(255)))
|
|
106
|
+
#
|
|
107
|
+
DataComparer.__compare_data(self, actual_data, expected_data)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def compare_text_file_with_text_variable(self, actual_file, expected_text):
|
|
111
|
+
if not os.path.exists(actual_file):
|
|
112
|
+
raise Exception("Input file doesn't exists: ", actual_file)
|
|
113
|
+
#
|
|
114
|
+
if 'expected_text' not in locals():
|
|
115
|
+
raise Exception("Input Expected data unknown.")
|
|
116
|
+
#
|
|
117
|
+
print("actual_file: ", actual_file)
|
|
118
|
+
#
|
|
119
|
+
with open(actual_file, mode='rt', encoding='utf-8') as actual_file:
|
|
120
|
+
actual_data = []
|
|
121
|
+
for line in actual_file.readlines():
|
|
122
|
+
actual_data.append(line.strip('\n').split(chr(255)))
|
|
123
|
+
#
|
|
124
|
+
expected_data = []
|
|
125
|
+
for line in expected_text.split('\n'):
|
|
126
|
+
expected_data.append(line.strip('\n').split(chr(255)))
|
|
127
|
+
#
|
|
128
|
+
DataComparer.__compare_data(self, actual_data, expected_data)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def compare_text_variables(self, actual_text, expected_text):
|
|
132
|
+
if 'actual_data' not in locals():
|
|
133
|
+
raise Exception("Input Actual data unknown.")
|
|
134
|
+
#
|
|
135
|
+
if 'expected_data' not in locals():
|
|
136
|
+
raise Exception("Input Expected data unknown.")
|
|
137
|
+
#
|
|
138
|
+
actual_data = []
|
|
139
|
+
for line in actual_text.split('\n'):
|
|
140
|
+
actual_data.append(line.strip('\n').split(chr(255)))
|
|
141
|
+
#
|
|
142
|
+
expected_data = []
|
|
143
|
+
for line in expected_text.split('\n'):
|
|
144
|
+
expected_data.append(line.strip('\n').split(chr(255)))
|
|
145
|
+
#
|
|
146
|
+
DataComparer.__compare_data(self, actual_data, expected_data)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def compare_text_files(self, actual_file, expected_file):
|
|
150
|
+
for file in (actual_file, expected_file):
|
|
151
|
+
if not os.path.exists(file):
|
|
152
|
+
raise Exception("Input file doesn't exists: ", file)
|
|
153
|
+
#
|
|
154
|
+
print("actual_file: ", actual_file)
|
|
155
|
+
print("expected_file: ", expected_file)
|
|
156
|
+
#
|
|
157
|
+
with open(actual_file, mode='rt', encoding='utf-8') as actual_file, open(expected_file, mode='rt', encoding='utf-8') as expected_file:
|
|
158
|
+
actual_data = []
|
|
159
|
+
for line in actual_file.readlines():
|
|
160
|
+
actual_data.append(line.strip('\n').split(chr(255)))
|
|
161
|
+
# print(actual_data)
|
|
162
|
+
#
|
|
163
|
+
expected_data = []
|
|
164
|
+
for line in expected_file.readlines():
|
|
165
|
+
expected_data.append(line.strip('\n').split(chr(255)))
|
|
166
|
+
# print(expected_data)
|
|
167
|
+
#
|
|
168
|
+
DataComparer.__compare_data(self, actual_data, expected_data)
|
|
169
|
+
|
|
170
|
+
|
|
88
171
|
def __compare_data(self, actual_data, expected_data_including_templates):
|
|
89
172
|
difference_found = False
|
|
90
173
|
#
|
|
@@ -401,3 +484,4 @@ class DataComparer:
|
|
|
401
484
|
else:
|
|
402
485
|
return string.isdigit()
|
|
403
486
|
|
|
487
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/src/DataComparerLibrary/datasorter.py
RENAMED
|
File without changes
|
|
File without changes
|
{datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/src/DataComparerLibrary/fileconverter.py
RENAMED
|
File without changes
|
|
File without changes
|
{datacomparerlibrary-0.841 → datacomparerlibrary-0.843}/src/DataComparerLibrary.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|