/usr/lib/python2.7/dist-packages/h5py/tests/hl/test_file.py is in python-h5py 2.6.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 | # 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.
"""
Tests the h5py.File object.
"""
from __future__ import absolute_import
import h5py
from ..common import ut, TestCase
def nfiles():
return h5py.h5f.get_obj_count(h5py.h5f.OBJ_ALL, h5py.h5f.OBJ_FILE)
def ngroups():
return h5py.h5f.get_obj_count(h5py.h5f.OBJ_ALL, h5py.h5f.OBJ_GROUP)
class TestDealloc(TestCase):
"""
Behavior on object dellocation. Note most of this behavior is
delegated to FileID.
"""
def test_autoclose(self):
""" File objects close automatically when out of scope, but
other objects remain open. """
start_nfiles = nfiles()
start_ngroups = ngroups()
fname = self.mktemp()
f = h5py.File(fname, 'w')
g = f['/']
self.assertEqual(nfiles(), start_nfiles+1)
self.assertEqual(ngroups(), start_ngroups+1)
del f
self.assertTrue(g)
self.assertEqual(nfiles(), start_nfiles)
self.assertEqual(ngroups(), start_ngroups+1)
f = g.file
self.assertTrue(f)
self.assertEqual(nfiles(), start_nfiles+1)
self.assertEqual(ngroups(), start_ngroups+1)
del g
self.assertEqual(nfiles(), start_nfiles+1)
self.assertEqual(ngroups(), start_ngroups)
del f
self.assertEqual(nfiles(), start_nfiles)
self.assertEqual(ngroups(), start_ngroups)
|