File size: 896 Bytes
f421c2e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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)()