/usr/lib/python3/dist-packages/h5py/tests/old/test_h5f.py is in python3-h5py 2.7.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | # This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
from __future__ import absolute_import
try:
import unittest2 as ut
except ImportError:
import unittest as ut
import tempfile
import shutil
import os
from h5py import File
class TestFileID(ut.TestCase):
def test_descriptor_core(self):
with File('TestFileID.test_descriptor_core', driver='core', backing_store=False) as f:
with self.assertRaises(NotImplementedError):
f.id.get_vfd_handle()
def test_descriptor_sec2(self):
dn_tmp = tempfile.mkdtemp('h5py.lowtest.test_h5f.TestFileID.test_descriptor_sec2')
fn_h5 = os.path.join(dn_tmp, 'test.h5')
try:
with File(fn_h5, driver='sec2') as f:
descriptor = f.id.get_vfd_handle()
self.assertNotEqual(descriptor, 0)
os.fsync(descriptor)
finally:
shutil.rmtree(dn_tmp)
class TestCacheConfig(ut.TestCase):
def test_simple_gets(self):
dn_tmp = tempfile.mkdtemp('h5py.lowtest.test_h5f.TestFileID.TestCacheConfig.test_simple_gets')
fn_h5 = os.path.join(dn_tmp, 'test.h5')
try:
with File(fn_h5) as f:
hit_rate = f._id.get_mdc_hit_rate()
mdc_size = f._id.get_mdc_size()
finally:
shutil.rmtree(dn_tmp)
def test_hitrate_reset(self):
dn_tmp = tempfile.mkdtemp('h5py.lowtest.test_h5f.TestFileID.TestCacheConfig.test_hitrate_reset')
fn_h5 = os.path.join(dn_tmp, 'test.h5')
try:
with File(fn_h5) as f:
hit_rate = f._id.get_mdc_hit_rate()
f._id.reset_mdc_hit_rate_stats()
hit_rate = f._id.get_mdc_hit_rate()
assert hit_rate == 0
finally:
shutil.rmtree(dn_tmp)
def test_mdc_config_get(self):
dn_tmp = tempfile.mkdtemp('h5py.lowtest.test_h5f.TestFileID.TestCacheConfig.test_mdc_config_get')
fn_h5 = os.path.join(dn_tmp, 'test.h5')
try:
with File(fn_h5) as f:
conf = f._id.get_mdc_config()
f._id.set_mdc_config(conf)
finally:
shutil.rmtree(dn_tmp)
|