pytest_arraydiff/plugin.py
changed.
Showing 1 of 1 files from the diff.
@@ -154,9 +154,41 @@
Loading
154 | 154 | return np.savetxt(filename, data, **kwargs) |
|
155 | 155 | ||
156 | 156 | ||
157 | + | class PDHDFDiff(BaseDiff): |
|
158 | + | ||
159 | + | extension = 'h5' |
|
160 | + | ||
161 | + | @staticmethod |
|
162 | + | def read(filename): |
|
163 | + | import pandas as pd |
|
164 | + | return pd.read_hdf(filename) |
|
165 | + | ||
166 | + | @staticmethod |
|
167 | + | def write(filename, data, **kwargs): |
|
168 | + | import pandas as pd |
|
169 | + | key = os.path.basename(filename).replace('.h5', '') |
|
170 | + | return data.to_hdf(filename, key, **kwargs) |
|
171 | + | ||
172 | + | @classmethod |
|
173 | + | def compare(cls, reference_file, test_file, atol=None, rtol=None): |
|
174 | + | import pandas.testing as pdt |
|
175 | + | ||
176 | + | ||
177 | + | try: |
|
178 | + | pdt.assert_frame_equal(reference_file, test_file) |
|
179 | + | except AssertionError as exc: |
|
180 | + | message = "\n\na: {0}".format(test_file) + '\n' |
|
181 | + | message += "b: {0}".format(reference_file) + '\n' |
|
182 | + | message += exc.args[0] |
|
183 | + | return False, message |
|
184 | + | else: |
|
185 | + | return True, "" |
|
186 | + | ||
187 | + | ||
157 | 188 | FORMATS = {} |
|
158 | 189 | FORMATS['fits'] = FITSDiff |
|
159 | 190 | FORMATS['text'] = TextDiff |
|
191 | + | FORMATS['pdhdf'] = PDHDFDiff |
|
160 | 192 | ||
161 | 193 | ||
162 | 194 | def _download_file(url): |
Files | Coverage |
---|---|
pytest_arraydiff | 77.72% |
Project Totals (2 files) | 77.72% |
95.1
TRAVIS_OS_NAME=linux
95.3
TRAVIS_OS_NAME=linux
95.2
TRAVIS_OS_NAME=linux
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.