timzatko / Sklearn-Nature-Inspired-Algorithms

Nature-inspired algorithms for hyper-parameter tuning of Scikit-Learn models.
https://sklearn-nature-inspired-algorithms.readthedocs.io/en/stable/
MIT License
28 stars 9 forks source link

Python3.12: Fix AttributeError #26

Closed penguinpee closed 1 year ago

penguinpee commented 1 year ago

With Python3.12 assertEquals appears to have been dropped in favor of assertEqual. This also works for Python <= 3.12. Bu I'm not sure how far back, though.

penguinpee commented 1 year ago

Full error message when running tests with Python 3.12:

ERROR: test_cv_is_int (tests.model_selection.cross_validation_test_case.CrossValidationTestCase.test_cv_is_int)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Sklearn-Nature-Inspired-Algorithms-0.11.0/tests/model_selection/cross_validation_test_case.py", line 52, in test_cv_is_int
    self.assertEquals(25 * 3 + 1, method_calls)
    ^^^^^^^^^^^^^^^^^
AttributeError: 'CrossValidationTestCase' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

======================================================================
ERROR: test_cv_is_object (tests.model_selection.cross_validation_test_case.CrossValidationTestCase.test_cv_is_object)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Sklearn-Nature-Inspired-Algorithms-0.11.0/tests/model_selection/cross_validation_test_case.py", line 63, in test_cv_is_object
    self.assertEquals(152, method_calls)
    ^^^^^^^^^^^^^^^^^
AttributeError: 'CrossValidationTestCase' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?