summaryrefslogtreecommitdiff
path: root/silx/io/test/test_spectoh5.py
diff options
context:
space:
mode:
Diffstat (limited to 'silx/io/test/test_spectoh5.py')
-rw-r--r--silx/io/test/test_spectoh5.py23
1 files changed, 9 insertions, 14 deletions
diff --git a/silx/io/test/test_spectoh5.py b/silx/io/test/test_spectoh5.py
index 421c48b..8020731 100644
--- a/silx/io/test/test_spectoh5.py
+++ b/silx/io/test/test_spectoh5.py
@@ -1,6 +1,6 @@
# coding: utf-8
# /*##########################################################################
-# Copyright (C) 2016-2017 European Synchrotron Radiation Facility
+# Copyright (C) 2016-2018 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -23,8 +23,7 @@
# ############################################################################*/
"""Tests for SpecFile to HDF5 converter"""
-import gc
-from numpy import array_equal, string_
+from numpy import array_equal
import os
import sys
import tempfile
@@ -41,7 +40,7 @@ else:
__authors__ = ["P. Knobel"]
__license__ = "MIT"
-__date__ = "02/06/2017"
+__date__ = "12/02/2018"
sftext = """#F /tmp/sf.dat
@@ -93,7 +92,7 @@ class TestConvertSpecHDF5(unittest.TestCase):
@classmethod
def setUpClass(cls):
fd, cls.spec_fname = tempfile.mkstemp(text=False)
- if sys.version < '3.0':
+ if sys.version_info < (3, ):
os.write(fd, sftext)
else:
os.write(fd, bytes(sftext, 'ascii'))
@@ -115,11 +114,9 @@ class TestConvertSpecHDF5(unittest.TestCase):
self.h5f = h5py.File(self.h5_fname, "a")
def tearDown(self):
- del self.sfh5
self.h5f.close()
- del self.h5f
+ self.sfh5.close()
os.unlink(self.h5_fname)
- gc.collect()
def testAppendToHDF5(self):
write_to_h5(self.sfh5, self.h5f, h5path="/foo/bar/spam")
@@ -141,24 +138,22 @@ class TestConvertSpecHDF5(unittest.TestCase):
def testTitle(self):
"""Test the value of a dataset"""
title12 = self.h5f["/1.2/title"].value
- if sys.version > '3.0':
- title12 = title12.decode()
self.assertEqual(title12,
- "1 aaaaaa")
+ u"aaaaaa")
def testAttrs(self):
# Test root group (file) attributes
self.assertEqual(self.h5f.attrs["NX_class"],
- string_("NXroot"))
+ u"NXroot")
# Test dataset attributes
ds = self.h5f["/1.2/instrument/mca_1/data"]
self.assertTrue("interpretation" in ds.attrs)
self.assertEqual(list(ds.attrs.values()),
- [string_("spectrum")])
+ [u"spectrum"])
# Test group attributes
grp = self.h5f["1.1"]
self.assertEqual(grp.attrs["NX_class"],
- string_("NXentry"))
+ u"NXentry")
self.assertEqual(len(list(grp.attrs.keys())),
1)