Ejemplo n.º 1
0
 def test_mismatch_oneth(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         f = _create_parent_child(f, (11, 17), (13, 17))
         f.close()
         validation = bald.validate_hdf5(tfile)
         self.assertFalse(validation.is_valid())
Ejemplo n.º 2
0
 def test_match(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         f = _create_parent_child(f, (11, 17), (11, 17))
         f.close()
         validation = bald.validate_hdf5(tfile, cache=self.acache)
         exns = validation.exceptions()
         self.assertTrue(validation.is_valid(), msg='{}  != []'.format(exns))
Ejemplo n.º 3
0
 def test_match_clead_dim(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         # child has leading dimension wrt parent
         f = _create_parent_child(f, (13, 17), (7, 13, 17))
         f.close()
         validation = bald.validate_hdf5(tfile)
         self.assertTrue(validation.is_valid())
Ejemplo n.º 4
0
 def test_invalid_uri(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         f = _create_parent_child(f, (11, 17), (11, 17))
         f.attrs['bald__turtle'] = 'bald__walnut'
         f.close()
         validation = bald.validate_hdf5(tfile)
         self.assertFalse(validation.is_valid())
Ejemplo n.º 5
0
 def test_mismatch_pdisjc_trail_dim(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         # child and parent have disjoint trailing dimensions
         f = _create_parent_child(f, (13, 17, 2), (13, 17, 9))
         f.close()
         validation = bald.validate_hdf5(tfile)
         self.assertFalse(validation.is_valid())
Ejemplo n.º 6
0
 def test_match(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         f = _create_parent_child(f, (11, 17), (11, 17))
         f.close()
         validation = bald.validate_hdf5(tfile)
         exns = validation.exceptions()
         self.assertTrue(validation.is_valid(),
                         msg='{}  != []'.format(exns))
Ejemplo n.º 7
0
 def test_match_clead_dim(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         # child has leading dimension wrt parent
         f = _create_parent_child(f, (13, 17), (7, 13, 17))
         f.close()
         validation = bald.validate_hdf5(tfile, cache=self.acache)
         exs = validation.exceptions()
         self.assertTrue(validation.is_valid(), msg='{}  != []'.format(exs))
Ejemplo n.º 8
0
 def test_valid_uri(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         group_alias = f.create_group('bald__alias_list')
         f.attrs['bald__isAliasedBy'] = group_alias.ref
         group_alias.attrs['skosPrefLabel'] = 'http://www.w3.org/2004/02/skos/core#prefLabel'
         dsetp = f.create_dataset("parent_dataset", (11, 17), dtype='i')
         dsetp.attrs['skosPrefLabel'] = 'alabel'
         f.close()
         validation = bald.validate_hdf5(tfile, cache=self.acache)
         exns = validation.exceptions()
         self.assertTrue(validation.is_valid(), msg='{}  != []'.format(exns))
Ejemplo n.º 9
0
 def test_valid_uri(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         group_alias = f.create_group('bald__alias_list')
         f.attrs['bald__isAliasedBy'] = group_alias.ref
         group_alias.attrs['skosPrefLabel'] = 'http://www.w3.org/2004/02/skos/core#prefLabel'
         dsetp = f.create_dataset("parent_dataset", (11, 17), dtype='i')
         dsetp.attrs['skosPrefLabel'] = 'alabel'
         f.close()
         validation = bald.validate_hdf5(tfile)
         exns = validation.exceptions()
         self.assertTrue(validation.is_valid(), msg='{}  != []'.format(exns))
Ejemplo n.º 10
0
 def test_mismatch_oneth(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         f = _create_parent_child(f, (11, 17), (13, 17))
         f.close()
         validation = bald.validate_hdf5(tfile)
         exns = validation.exceptions()
         expected = [
             'p declares a child of c but the arrays do not conform to the bald array reference rules'
         ]
         self.assertTrue((not validation.is_valid()) and exns == expected,
                         msg='{}  != {}'.format(exns, expected))
Ejemplo n.º 11
0
 def test_invalid_uri(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         f.attrs['bald__turtle'] = 'bald__walnut'
         group_alias = f.create_group('bald__alias_list')
         f.attrs['bald__isAliasedBy'] = group_alias.ref
         group_alias.attrs[
             'skosPrefLabel'] = 'http://www.w3.org/2004/02/skos/core#notThisPrefLabel'
         dsetp = f.create_dataset("parent_dataset", (11, 17), dtype='i')
         dsetp.attrs['skosPrefLabel'] = 'alabel'
         f.close()
         validation = bald.validate_hdf5(tfile)
         self.assertFalse(validation.is_valid())
Ejemplo n.º 12
0
 def test_mismatch_pdisjc_trail_dim(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         # child and parent have disjoint trailing dimensions
         f = _create_parent_child(f, (13, 17, 2), (13, 17, 9))
         f.close()
         validation = bald.validate_hdf5(tfile)
         exns = validation.exceptions()
         expected = [
             'parent_dataset declares a child of child_dataset but the arrays do not conform to the bald array reference rules'
         ]
         self.assertTrue((not validation.is_valid()) and exns == expected,
                         msg='{}  != {}'.format(exns, expected))
Ejemplo n.º 13
0
 def test_invalid_uri(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         f = _create_parent_child(f, (11, 17), (11, 17))
         f.attrs['bald__turtle'] = 'bald__walnut'
         f.close()
         validation = bald.validate_hdf5(tfile, cache=self.acache,
                                         uris_resolve=True)
         exns = validation.exceptions()
         expected = ['http://binary-array-ld.net/latest/turtle is not resolving as a resource (404).',
                     'http://binary-array-ld.net/latest/walnut is not resolving as a resource (404).']
         self.assertTrue((not validation.is_valid()) and exns == expected,
                          msg='{}  != {}'.format(exns, expected))
Ejemplo n.º 14
0
 def test_invalid_uri(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         f = _create_parent_child(f, (11, 17), (11, 17))
         f.attrs['bald__turtle'] = 'bald__walnut'
         f.close()
         validation = bald.validate_hdf5(tfile)
         exns = validation.exceptions()
         expected = [
             'http://binary-array-ld.net/latest/turtle is not resolving as a resource (404).',
             'http://binary-array-ld.net/latest/walnut is not resolving as a resource (404).'
         ]
         self.assertTrue((not validation.is_valid()) and exns == expected,
                         msg='{}  != {}'.format(exns, expected))
Ejemplo n.º 15
0
 def test_invalid_uri(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         f.attrs['bald__turtle'] = 'bald__walnut'
         group_alias = f.create_group('bald__alias_list')
         f.attrs['bald__isAliasedBy'] = group_alias.ref            
         group_alias.attrs['skosPrefLabel'] = 'http://www.w3.org/2004/02/skos/core#notThisPrefLabel'
         dsetp = f.create_dataset("parent_dataset", (11, 17), dtype='i')
         dsetp.attrs['skosPrefLabel'] = 'alabel'
         f.close()
         validation = bald.validate_hdf5(tfile)
         exns = validation.exceptions()
         expected = ['http://binary-array-ld.net/latest/turtle is not resolving as a resource (404).',
                     'http://binary-array-ld.net/latest/walnut is not resolving as a resource (404).']
         self.assertTrue((not validation.is_valid()) and exns == expected,
                          msg='{}  != {}'.format(exns, expected))
Ejemplo n.º 16
0
 def test_invalid_uri(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         f.attrs['bald__turtle'] = 'bald__walnut'
         group_alias = f.create_group('bald__alias_list')
         f.attrs['bald__isAliasedBy'] = group_alias.ref            
         group_alias.attrs['skosPrefLabel'] = 'http://www.w3.org/2004/02/skos/core#notThisPrefLabel'
         dsetp = f.create_dataset("parent_dataset", (11, 17), dtype='i')
         dsetp.attrs['skosPrefLabel'] = 'alabel'
         f.close()
         validation = bald.validate_hdf5(tfile, cache=self.acache)
         exns = validation.exceptions()
         expected = ['http://binary-array-ld.net/latest/turtle is not resolving as a resource (404).',
                     'http://binary-array-ld.net/latest/walnut is not resolving as a resource (404).']
         self.assertTrue((not validation.is_valid()) and exns == expected,
                          msg='{}  != {}'.format(exns, expected))
Ejemplo n.º 17
0
 def test_mismatch_oneth(self):
     with self.temp_filename('.hdf') as tfile:
         f = h5py.File(tfile, "w")
         f = _fattrs(f)
         f = _create_parent_child(f, (11, 17), (13, 17))
         f.close()
         fname = ('file:///tests/integration/test_validation/Test/'
                  'test_mismatch_oneth.hdf')
         validation = bald.validate_hdf5(tfile, baseuri=fname, cache=self.acache)
         exns = validation.exceptions()
         expected = ['file:///tests/integration/test_validation/Test/'
                     'test_mismatch_oneth.hdf/parent_dataset declares a '
                     'child of file:///tests/integration/test_validation/'
                     'Test/test_mismatch_oneth.hdf/child_dataset but the'
                     ' arrays do not conform to the bald array reference '
                     'rules']
         self.assertTrue((not validation.is_valid()) and exns == expected,
                          msg='{}  != {}'.format(exns, expected))
Ejemplo n.º 18
0
    def test_mismatch_pdisjc_trail_dim(self):
        with self.temp_filename('.hdf') as tfile:
            f = h5py.File(tfile, "w")
            f = _fattrs(f)
            # child and parent have disjoint trailing dimensions
            f = _create_parent_child(f, (13, 17, 2), (13, 17, 9))
            f.close()
            fname = ('file:///tests/integration/test_validation/Test/'
                     'test_mismatch_pdisjc_trail_dim.hdf')
            validation = bald.validate_hdf5(tfile, baseuri=fname, cache=self.acache)

            exns = validation.exceptions()
            expected = ['file:///tests/integration/test_validation/Test/'
                        'test_mismatch_pdisjc_trail_dim.hdf/parent_dataset'
                        ' declares a child of file:///tests/integration/'
                        'test_validation/Test/test_mismatch_pdisjc_trail_dim'
                        '.hdf/child_dataset but the arrays do not conform to '
                        'the bald array reference rules']
            self.assertTrue((not validation.is_valid()) and exns == expected,
                             msg='{}  != {}'.format(exns, expected))