[Darshan-commits] [Git][darshan/darshan][master] 2 commits: TST: add DarshanReport deepcopy test
Shane Snyder
xgitlab at cels.anl.gov
Tue May 11 15:43:07 CDT 2021
Shane Snyder pushed to branch master at darshan / darshan
Commits:
97699ea7 by Tyler Reddy at 2021-04-21T16:11:22-06:00
TST: add DarshanReport deepcopy test
* add a regression test for the `__deepcopy__` method
of `DarshanReport`; verifies floating point value
similarity to original data and lack of memory overlap
- - - - -
f471874f by Shane Snyder at 2021-05-11T15:42:34-05:00
Merge branch 'treddy/darshan-treddy_test_darshanreport_deepcopy' into HEAD
- - - - -
1 changed file:
- darshan-util/pydarshan/tests/test_report.py
Changes:
=====================================
darshan-util/pydarshan/tests/test_report.py
=====================================
@@ -3,7 +3,11 @@
"""Tests for `pydarshan` package."""
+import copy
+
import pytest
+import numpy as np
+from numpy.testing import assert_allclose
import darshan
@@ -133,3 +137,20 @@ def test_json_fidelity():
'dvs',
'rootfs']:
assert expected_value in actual_json
+
+ at pytest.mark.parametrize("key", ['POSIX', 'MPI-IO', 'STDIO'])
+ at pytest.mark.parametrize("subkey", ['counters', 'fcounters'])
+def test_deepcopy_fidelity_darshan_report(key, subkey):
+ # regression guard for the __deepcopy__() method
+ # of DarshanReport class
+ # note that to_numpy() also performs a deepcopy
+ report = darshan.DarshanReport("tests/input/sample.darshan")
+ report_deepcopy = copy.deepcopy(report)
+ # the deepcopied records should be identical
+ # within floating point tolerance
+ assert_allclose(report_deepcopy.data['records'][key].to_numpy()[0][subkey],
+ report.data['records'][key].to_numpy()[0][subkey])
+ # a deepcopy should not share memory bounds
+ # with the original object (or deepcopies thereof)
+ assert not np.may_share_memory(report_deepcopy.data['records'][key].to_numpy()[0][subkey],
+ report.data['records'][key].to_numpy()[0][subkey])
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/compare/457b69ce90530f23856c22ae16fd752e1c7dc69e...f471874fa92d9e6a7061429cc0cf4e1ff9da5188
--
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/compare/457b69ce90530f23856c22ae16fd752e1c7dc69e...f471874fa92d9e6a7061429cc0cf4e1ff9da5188
You're receiving this email because of your account on xgitlab.cels.anl.gov.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20210511/663d2ef6/attachment-0001.html>
More information about the Darshan-commits
mailing list