/usr/lib/python3/dist-packages/h5py/tests/old/test_datatype.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 | # 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.
"""
File-resident datatype tests.
Tests "committed" file-resident datatype objects.
"""
from __future__ import absolute_import
import six
import numpy as np
from .common import ut, TestCase
from h5py import File
from h5py._hl.datatype import Datatype
class BaseType(TestCase):
def setUp(self):
self.f = File(self.mktemp(), 'w')
def tearDown(self):
if self.f:
self.f.close()
class TestCreation(BaseType):
"""
Feature: repr() works sensibly on datatype objects
"""
def test_repr(self):
""" repr() on datatype objects """
self.f['foo'] = np.dtype('S10')
dt = self.f['foo']
self.assertIsInstance(repr(dt), six.string_types)
self.f.close()
self.assertIsInstance(repr(dt), six.string_types)
def test_appropriate_low_level_id(self):
" Binding a group to a non-TypeID identifier fails with ValueError "
with self.assertRaises(ValueError):
Datatype(self.f['/'].id)
|