summaryrefslogtreecommitdiff
path: root/silx/io/test/test_specfile.py
diff options
context:
space:
mode:
authorAlexandre Marie <alexandre.marie@synchrotron-soleil.fr>2019-07-09 10:20:20 +0200
committerAlexandre Marie <alexandre.marie@synchrotron-soleil.fr>2019-07-09 10:20:20 +0200
commit654a6ac93513c3cc1ef97cacd782ff674c6f4559 (patch)
tree3b986e4972de7c57fa465820367602fc34bcb0d3 /silx/io/test/test_specfile.py
parenta763e5d1b3921b3194f3d4e94ab9de3fbe08bbdd (diff)
New upstream version 0.11.0+dfsg
Diffstat (limited to 'silx/io/test/test_specfile.py')
-rw-r--r--silx/io/test/test_specfile.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/silx/io/test/test_specfile.py b/silx/io/test/test_specfile.py
index 55850f1..79d5544 100644
--- a/silx/io/test/test_specfile.py
+++ b/silx/io/test/test_specfile.py
@@ -1,6 +1,6 @@
# coding: utf-8
# /*##########################################################################
-# Copyright (C) 2016-2017 European Synchrotron Radiation Facility
+# Copyright (C) 2016-2019 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
@@ -224,14 +224,21 @@ class TestSpecFile(unittest.TestCase):
with self.assertRaises(specfile.SfErrScanNotFound):
self.sf.index(99)
+ def assertRaisesRegex(self, *args, **kwargs):
+ # Python 2 compatibility
+ if sys.version_info.major >= 3:
+ return super(TestSpecFile, self).assertRaisesRegex(*args, **kwargs)
+ else:
+ return self.assertRaisesRegexp(*args, **kwargs)
+
def test_getitem(self):
self.assertIsInstance(self.sf[2], Scan)
self.assertIsInstance(self.sf["1.2"], Scan)
# int out of range
- with self.assertRaisesRegexp(IndexError, 'Scan index must be in ran'):
+ with self.assertRaisesRegex(IndexError, 'Scan index must be in ran'):
self.sf[107]
# float indexing not allowed
- with self.assertRaisesRegexp(TypeError, 'The scan identification k'):
+ with self.assertRaisesRegex(TypeError, 'The scan identification k'):
self.sf[1.2]
# non existant scan with "N.M" indexing
with self.assertRaises(KeyError):