-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAINT update the python version supported (#1073)
- Loading branch information
Showing
3 changed files
with
25 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,23 @@ | |
# Authors: Guillaume Lemaitre <[email protected]> | ||
# License: MIT | ||
|
||
import sys | ||
import textwrap | ||
|
||
import pytest | ||
|
||
from imblearn.utils import Substitution | ||
from imblearn.utils._docstring import _n_jobs_docstring, _random_state_docstring | ||
|
||
|
||
def _dedent_docstring(docstring): | ||
"""Compatibility with Python 3.13+. | ||
xref: https://github.com/python/cpython/issues/81283 | ||
""" | ||
return "\n".join([textwrap.dedent(line) for line in docstring.split("\n")]) | ||
|
||
|
||
func_docstring = """A function. | ||
Parameters | ||
|
@@ -55,6 +67,11 @@ def __init__(self, param_1, param_2): | |
self.param_2 = param_2 | ||
|
||
|
||
if sys.version_info.minor == "13": | ||
func_docstring = _dedent_docstring(func_docstring) | ||
cls_docstring = _dedent_docstring(cls_docstring) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"obj, obj_docstring", [(func, func_docstring), (cls, cls_docstring)] | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters