Skip to content

Commit e26d278

Browse files
committed
test ready
1 parent c1f670a commit e26d278

File tree

1 file changed

+12
-82
lines changed

1 file changed

+12
-82
lines changed

lib/bald/tests/integration/test_aliases.py

Lines changed: 12 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
def _fattrs(f):
1010
f.attrs['rdf__type'] = 'bald__Container'
11-
group_alias = f.create_group('bald__alias_list')
11+
group_pref = f.create_group('bald__prefix_list')
1212
group_pref.attrs['bald__'] = 'http://binary-array-ld.net/latest/'
1313
group_pref.attrs['rdf__'] = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
14-
f.attrs['bald__aliases'] = group_alias.ref
14+
f.attrs['bald__isPrefixedBy'] = group_pref.ref
1515
return f
1616

1717
def _create_parent_child(f, pshape, cshape):
@@ -31,7 +31,11 @@ def test_valid_uri(self):
3131
with self.temp_filename('.hdf') as tfile:
3232
f = h5py.File(tfile, "w")
3333
f = _fattrs(f)
34-
f = _create_parent_child(f, (11, 17), (11, 17))
34+
group_alias = f.create_group('bald__alias_list')
35+
f.attrs['bald__aliases'] = group_alias.ref
36+
group_alias['skosPrefLabel'] = 'http://www.w3.org/2004/02/skos/core#prefLabel'
37+
dsetp = f.create_dataset("parent_dataset", (11, 17), dtype='i')
38+
dsetp.attrs['skosPrefLabel'] = 'alabel'
3539
f.close()
3640
validation = bald.validate_hdf5(tfile)
3741
self.assertTrue(validation.is_valid())
@@ -40,90 +44,16 @@ def test_invalid_uri(self):
4044
with self.temp_filename('.hdf') as tfile:
4145
f = h5py.File(tfile, "w")
4246
f = _fattrs(f)
43-
f = _create_parent_child(f, (11, 17), (11, 17))
4447
f.attrs['bald__turtle'] = 'bald__walnut'
48+
group_alias = f.create_group('bald__alias_list')
49+
f.attrs['bald__aliases'] = group_alias.ref
50+
group_alias['skosPrefLabel'] = 'http://www.w3.org/2004/02/skos/core#notThisPrefLabel'
51+
dsetp = f.create_dataset("parent_dataset", (11, 17), dtype='i')
52+
dsetp.attrs['skosPrefLabel'] = 'alabel'
4553
f.close()
4654
validation = bald.validate_hdf5(tfile)
4755
self.assertFalse(validation.is_valid())
4856

49-
class TestArrayReference(BaldTestCase):
50-
def test_match(self):
51-
with self.temp_filename('.hdf') as tfile:
52-
f = h5py.File(tfile, "w")
53-
f = _fattrs(f)
54-
f = _create_parent_child(f, (11, 17), (11, 17))
55-
f.close()
56-
validation = bald.validate_hdf5(tfile)
57-
self.assertTrue(validation.is_valid())
58-
59-
def test_mismatch_zeroth(self):
60-
with self.temp_filename('.hdf') as tfile:
61-
f = h5py.File(tfile, "w")
62-
f = _fattrs(f)
63-
f = _create_parent_child(f, (11, 17), (11, 13))
64-
f.close()
65-
validation = bald.validate_hdf5(tfile)
66-
self.assertFalse(validation.is_valid())
67-
68-
def test_mismatch_oneth(self):
69-
with self.temp_filename('.hdf') as tfile:
70-
f = h5py.File(tfile, "w")
71-
f = _fattrs(f)
72-
f = _create_parent_child(f, (11, 17), (13, 17))
73-
f.close()
74-
validation = bald.validate_hdf5(tfile)
75-
self.assertFalse(validation.is_valid())
76-
77-
def test_match_plead_dim(self):
78-
with self.temp_filename('.hdf') as tfile:
79-
f = h5py.File(tfile, "w")
80-
f = _fattrs(f)
81-
# parent has leading dimension wrt child
82-
f = _create_parent_child(f, (4, 13, 17), (13, 17))
83-
f.close()
84-
validation = bald.validate_hdf5(tfile)
85-
self.assertTrue(validation.is_valid())
86-
87-
def test_match_clead_dim(self):
88-
with self.temp_filename('.hdf') as tfile:
89-
f = h5py.File(tfile, "w")
90-
f = _fattrs(f)
91-
# child has leading dimension wrt parent
92-
f = _create_parent_child(f, (13, 17), (7, 13, 17))
93-
f.close()
94-
validation = bald.validate_hdf5(tfile)
95-
self.assertTrue(validation.is_valid())
96-
97-
def test_mismatch_pdisjc_lead_dim(self):
98-
with self.temp_filename('.hdf') as tfile:
99-
f = h5py.File(tfile, "w")
100-
f = _fattrs(f)
101-
# child and parent have disjoint leading dimensions
102-
f = _create_parent_child(f, (4, 13, 17), (7, 13, 17))
103-
104-
f.close()
105-
validation = bald.validate_hdf5(tfile)
106-
self.assertFalse(validation.is_valid())
107-
108-
def test_mismatch_pdisjc_trail_dim(self):
109-
with self.temp_filename('.hdf') as tfile:
110-
f = h5py.File(tfile, "w")
111-
f = _fattrs(f)
112-
# child and parent have disjoint trailing dimensions
113-
f = _create_parent_child(f, (13, 17, 2), (13, 17, 9))
114-
f.close()
115-
validation = bald.validate_hdf5(tfile)
116-
self.assertFalse(validation.is_valid())
117-
118-
119-
# def test_match_(self):
120-
# with self.temp_filename('.hdf') as tfile:
121-
# f = h5py.File(tfile, "w")
122-
# f = _fattrs(f)
123-
# #
124-
# f = _create_parent_child(f, (), ())
125-
# f.close()
126-
# self.assert(bald.validate_hdf5(tfile).is_valid())
12757

12858
if __name__ == '__main__':
12959
unittest.main()

0 commit comments

Comments
 (0)