- Add unittest.patch to fix assert calls on Python 3.12 OBS-URL: https://build.opensuse.org/request/show/1155584 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-pypet?expand=0&rev=15
51 lines
2.3 KiB
Diff
51 lines
2.3 KiB
Diff
From 1cf5bd7deffe2eaa91c6fd96b63dbb5f0d7eeafb Mon Sep 17 00:00:00 2001
|
|
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
|
|
Date: Sat, 14 Oct 2023 10:54:25 -0400
|
|
Subject: [PATCH] Replace deprecated/removed unittest.TestCase method aliases
|
|
|
|
The method alias unittest.TestCase.assertEquals() was deprecated in
|
|
Python 3.2 and removed in Python 3.12. Replace it with
|
|
unittest.TestCase.assertEqual().
|
|
|
|
https://docs.python.org/3.11/library/unittest.html#deprecated-aliases
|
|
---
|
|
pypet/tests/unittests/brian2tests/brian2_parameter_test.py | 2 +-
|
|
pypet/tests/unittests/storage_test.py | 4 ++--
|
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/pypet/tests/unittests/brian2tests/brian2_parameter_test.py b/pypet/tests/unittests/brian2tests/brian2_parameter_test.py
|
|
index b7d0d4cd..e34e73f4 100644
|
|
--- a/pypet/tests/unittests/brian2tests/brian2_parameter_test.py
|
|
+++ b/pypet/tests/unittests/brian2tests/brian2_parameter_test.py
|
|
@@ -250,7 +250,7 @@ class Brian2GetUnitFastTest(unittest.TestCase):
|
|
|
|
def test_get_unit_fast(self):
|
|
unit = get_unit_fast(42 * mV)
|
|
- self.assertEquals(unit, 1000 * mV)
|
|
+ self.assertEqual(unit, 1000 * mV)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
diff --git a/pypet/tests/unittests/storage_test.py b/pypet/tests/unittests/storage_test.py
|
|
index 6e189699..0bd849da 100644
|
|
--- a/pypet/tests/unittests/storage_test.py
|
|
+++ b/pypet/tests/unittests/storage_test.py
|
|
@@ -481,7 +481,7 @@ def test_maximum_overview_size(self):
|
|
|
|
store = pt.open_file(filename, mode='r+')
|
|
table = store.root._f_get_child(traj.v_name).overview.parameters_overview
|
|
- self.assertEquals(table.nrows, pypetconstants.HDF5_MAX_OVERVIEW_TABLE_LENGTH)
|
|
+ self.assertEqual(table.nrows, pypetconstants.HDF5_MAX_OVERVIEW_TABLE_LENGTH)
|
|
store.close()
|
|
|
|
for irun in range(pypetconstants.HDF5_MAX_OVERVIEW_TABLE_LENGTH,
|
|
@@ -492,7 +492,7 @@ def test_maximum_overview_size(self):
|
|
|
|
store = pt.open_file(filename, mode='r+')
|
|
table = store.root._f_get_child(traj.v_name).overview.parameters_overview
|
|
- self.assertEquals(table.nrows, pypetconstants.HDF5_MAX_OVERVIEW_TABLE_LENGTH)
|
|
+ self.assertEqual(table.nrows, pypetconstants.HDF5_MAX_OVERVIEW_TABLE_LENGTH)
|
|
store.close()
|
|
|
|
env.f_disable_logging()
|