Commit 238e93a0 authored by Florent Jaillet's avatar Florent Jaillet
Browse files

Avoid errors and warnings in tests with recent versions of the dependencies

parent 4332549b
Pipeline #1497 passed with stage
in 4 minutes and 5 seconds
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......@@ -80,12 +80,16 @@ class TestCompGabDual(unittest.TestCase):
# g should be float64 or complex128
g = np.arange(9)
mess = "g data should be numpy.float64 or numpy.complex128"
self.assertRaisesRegexp(TypeError, mess, comp_gabdual_long, g, 0, 0)
try:
assertRaisesRegex = self.assertRaisesRegex
except AttributeError:
assertRaisesRegex = self.assertRaisesRegexp
assertRaisesRegex(TypeError, mess, comp_gabdual_long, g, 0, 0)
g = g.astype(np.float64)
# g dim should be < 3
mess = "g dimensions should be 1 or 2."
self.assertRaisesRegexp(TypeError, mess, comp_gabdual_long,
g.reshape((3, 1, 3)), 0, 0)
assertRaisesRegex(
TypeError, mess, comp_gabdual_long, g.reshape((3, 1, 3)), 0, 0)
# basic test:
g.resize((3, 3))
gd = comp_gabdual_long(g, 1, 1)
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......@@ -62,9 +62,16 @@
from __future__ import print_function, division
import unittest
from ltfatpy.tests.datasets.read_dgt_signal_ex_mat import DgtSignals
import numpy
import fractions
try:
from math import gcd
except ImportError:
# fractions.gcd() is deprecated since Python 3.5 and math.gcd() should be
# used instead, but for backward compatibilty we use fractions.gcd() if
# math.gcd() is not available
from fractions import gcd
from ltfatpy.tests.datasets.read_dgt_signal_ex_mat import DgtSignals
from ltfatpy.tests.datasets.get_dataset_path import get_dataset_path
......@@ -107,7 +114,7 @@ class TestReadDgtSignalExt(unittest.TestCase):
if (gl == M):
assert DUAL_WINDOW.size == gl
elif (a != M):
assert DUAL_WINDOW.size == a * M // fractions.gcd(a, M)
assert DUAL_WINDOW.size == a * M // gcd(a, M)
else:
assert DUAL_WINDOW.size == a * 2
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
......@@ -32,7 +32,7 @@
# Version
# -------
#
# * ltfatpy version = 1.0.15
# * ltfatpy version = 1.0.16
# * LTFAT version = 2.1.0
#
# Licence
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment