39 lines
953 B
Python
39 lines
953 B
Python
# 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
|
|
|
|
from h5py import _objects as o
|
|
|
|
from ..common import TestCase
|
|
|
|
class TestObjects(TestCase):
|
|
|
|
def test_invalid(self):
|
|
# Check for segfault on close
|
|
oid = o.ObjectID(0)
|
|
del oid
|
|
oid = o.ObjectID(1)
|
|
del oid
|
|
|
|
def test_equality(self):
|
|
# Identifier-based equality
|
|
oid1 = o.ObjectID(42)
|
|
oid2 = o.ObjectID(42)
|
|
oid3 = o.ObjectID(43)
|
|
|
|
self.assertEqual(oid1, oid2)
|
|
self.assertNotEqual(oid1, oid3)
|
|
|
|
def test_hash(self):
|
|
# Default objects are not hashable
|
|
oid = o.ObjectID(42)
|
|
with self.assertRaises(TypeError):
|
|
hash(oid)
|
|
|