Download data/tests/unit/core/HealthCheckTest.py from introvoyz042/OpenPNM: direct link, hf CLI and curl.
- Browser
- Download file 896 Bytes
-
https://huggingface.co/datasets/introvoyz042/OpenPNM/resolve/main/data/tests/unit/core/HealthCheckTest.py
- Command line
-
hf download hf://datasets/introvoyz042/OpenPNM/data/tests/unit/core/HealthCheckTest.py
-
curl -L -o HealthCheckTest.py https://huggingface.co/datasets/introvoyz042/OpenPNM/resolve/main/data/tests/unit/core/HealthCheckTest.py
896 Bytes
| import numpy as np | |
| import openpnm as op | |
| class HealthCheckTest: | |
| def setup_class(self): | |
| self.ws = op.Workspace() | |
| self.ws.clear() | |
| self.net = op.network.Cubic(shape=[2, 2, 2]) | |
| def check_data_health(self): | |
| self.net.update({'pore.test': np.array([1, 2, 3, 4, 5, 6])}) | |
| a = op.utils.check_data_health(self.net) | |
| assert not a.health | |
| assert a['pore.test'] != [] | |
| assert a['pore.coords'] == [] | |
| assert a['throat.conns'] == [] | |
| self.net['pore.test'] = 1.0 | |
| self.net['pore.test'][0] = np.nan | |
| a = op.utils.check_data_health(self.net) | |
| assert a['pore.test'] != [] | |
| if __name__ == '__main__': | |
| t = HealthCheckTest() | |
| self = t | |
| t.setup_class() | |
| for item in t.__dir__(): | |
| if item.startswith('test'): | |
| print(f"Running test: {item}") | |
| t.__getattribute__(item)() | |