7
7
from bald .tests import BaldTestCase
8
8
9
9
def _fattrs (f ):
10
- f .attrs ['bald__' ] = 'http://binary-array-ld.net/experimental /'
10
+ f .attrs ['bald__' ] = 'http://binary-array-ld.net/latest /'
11
11
f .attrs ['rdf__' ] = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
12
12
f .attrs ['rdf__type' ] = 'bald__Container'
13
13
return f
14
14
15
15
def _create_parent_child (f , pshape , cshape ):
16
16
dsetp = f .create_dataset ("parent_dataset" , pshape , dtype = 'i' )
17
17
dsetc = f .create_dataset ("child_dataset" , cshape , dtype = 'i' )
18
- dsetp .attrs ['rdf__type' ] = 'bald__Dataset '
18
+ dsetp .attrs ['rdf__type' ] = 'bald__Array '
19
19
dsetp .attrs ['bald__references' ] = dsetc .ref
20
- dsetc .attrs ['rdf__type' ] = 'bald__Dataset '
20
+ dsetc .attrs ['rdf__type' ] = 'bald__Array '
21
21
dsetc .attrs ['rdf__type' ] = 'bald__Reference'
22
- dsetc .attrs ['bald__dataset ' ] = dsetc .ref
22
+ dsetc .attrs ['bald__array ' ] = dsetc .ref
23
23
return f
24
24
25
25
@@ -31,7 +31,8 @@ def test_valid_uri(self):
31
31
f = _fattrs (f )
32
32
f = _create_parent_child (f , (11 , 17 ), (11 , 17 ))
33
33
f .close ()
34
- self .assertTrue (bald .validate_hdf5 (tfile ).is_valid ())
34
+ validation = bald .validate_hdf5 (tfile )
35
+ self .assertTrue (validation .is_valid ())
35
36
36
37
def test_invalid_uri (self ):
37
38
with self .temp_filename ('.hdf' ) as tfile :
@@ -40,7 +41,8 @@ def test_invalid_uri(self):
40
41
f = _create_parent_child (f , (11 , 17 ), (11 , 17 ))
41
42
f .attrs ['bald__turtle' ] = 'bald__walnut'
42
43
f .close ()
43
- self .assertFalse (bald .validate_hdf5 (tfile ).is_valid ())
44
+ validation = bald .validate_hdf5 (tfile )
45
+ self .assertFalse (validation .is_valid ())
44
46
45
47
class TestArrayReference (BaldTestCase ):
46
48
def test_match (self ):
@@ -49,23 +51,26 @@ def test_match(self):
49
51
f = _fattrs (f )
50
52
f = _create_parent_child (f , (11 , 17 ), (11 , 17 ))
51
53
f .close ()
52
- self .assertTrue (bald .validate_hdf5 (tfile ).is_valid ())
54
+ validation = bald .validate_hdf5 (tfile )
55
+ self .assertTrue (validation .is_valid ())
53
56
54
57
def test_mismatch_zeroth (self ):
55
58
with self .temp_filename ('.hdf' ) as tfile :
56
59
f = h5py .File (tfile , "w" )
57
60
f = _fattrs (f )
58
61
f = _create_parent_child (f , (11 , 17 ), (11 , 13 ))
59
62
f .close ()
60
- self .assertFalse (bald .validate_hdf5 (tfile ).is_valid ())
63
+ validation = bald .validate_hdf5 (tfile )
64
+ self .assertFalse (validation .is_valid ())
61
65
62
66
def test_mismatch_oneth (self ):
63
67
with self .temp_filename ('.hdf' ) as tfile :
64
68
f = h5py .File (tfile , "w" )
65
69
f = _fattrs (f )
66
70
f = _create_parent_child (f , (11 , 17 ), (13 , 17 ))
67
71
f .close ()
68
- self .assertFalse (bald .validate_hdf5 (tfile ).is_valid ())
72
+ validation = bald .validate_hdf5 (tfile )
73
+ self .assertFalse (validation .is_valid ())
69
74
70
75
def test_match_plead_dim (self ):
71
76
with self .temp_filename ('.hdf' ) as tfile :
@@ -74,7 +79,8 @@ def test_match_plead_dim(self):
74
79
# parent has leading dimension wrt child
75
80
f = _create_parent_child (f , (4 , 13 , 17 ), (13 , 17 ))
76
81
f .close ()
77
- self .assertTrue (bald .validate_hdf5 (tfile ).is_valid ())
82
+ validation = bald .validate_hdf5 (tfile )
83
+ self .assertTrue (validation .is_valid ())
78
84
79
85
def test_match_clead_dim (self ):
80
86
with self .temp_filename ('.hdf' ) as tfile :
@@ -83,7 +89,8 @@ def test_match_clead_dim(self):
83
89
# child has leading dimension wrt parent
84
90
f = _create_parent_child (f , (13 , 17 ), (7 , 13 , 17 ))
85
91
f .close ()
86
- self .assertTrue (bald .validate_hdf5 (tfile ).is_valid ())
92
+ validation = bald .validate_hdf5 (tfile )
93
+ self .assertTrue (validation .is_valid ())
87
94
88
95
def test_mismatch_pdisjc_lead_dim (self ):
89
96
with self .temp_filename ('.hdf' ) as tfile :
@@ -93,7 +100,8 @@ def test_mismatch_pdisjc_lead_dim(self):
93
100
f = _create_parent_child (f , (4 , 13 , 17 ), (7 , 13 , 17 ))
94
101
95
102
f .close ()
96
- self .assertFalse (bald .validate_hdf5 (tfile ).is_valid ())
103
+ validation = bald .validate_hdf5 (tfile )
104
+ self .assertFalse (validation .is_valid ())
97
105
98
106
def test_mismatch_pdisjc_trail_dim (self ):
99
107
with self .temp_filename ('.hdf' ) as tfile :
@@ -102,8 +110,8 @@ def test_mismatch_pdisjc_trail_dim(self):
102
110
# child and parent have disjoint trailing dimensions
103
111
f = _create_parent_child (f , (13 , 17 , 2 ), (13 , 17 , 9 ))
104
112
f .close ()
105
- self . assertFalse ( bald .validate_hdf5 (tfile ). is_valid () )
106
-
113
+ validation = bald .validate_hdf5 (tfile )
114
+ self . assertFalse ( validation . is_valid ())
107
115
108
116
109
117
# def test_match_(self):
0 commit comments