dev-python/makefun: Bump to 1.15.3

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2024-07-06 07:22:45 +02:00
parent cb3c84c050
commit 5027ec7dba
3 changed files with 115 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST makefun-1.15.2.tar.gz 74602 BLAKE2B 1992eebfdbff6062ed60e1f66891995a91b7155792ef7b6e701d1d3ee5939ab40d3ab976674e25a5b97030cd7de59db2c69f3c215681cef2f80f2b64523f822b SHA512 b6cb588ebf491176b06e97201846b2a5cee65f60e34b5dbcc4878d8a55e7f9fcf4b58126cb3a4ca47f5d2726422dff9ee685566c5d093dbd8fd75119ecc796b2
DIST makefun-1.15.3.tar.gz 71799 BLAKE2B 3500be7bc5b0e86a6f75781bb8fb7156624e4c910f54dfd7498268f96cd3df84e1f4d4502f4705f9a278948043e571951137e420358e94e051ba81387b14d4ba SHA512 6d48d8e1bdd60ab440b31241a957ba60aa5ae6c77a7a4785dd0a3c6cf4cedd5389ff76d7a309d230bdf1db9be577ab85446741febb30dae0be87e9c3a2d003a0

View File

@@ -0,0 +1,80 @@
diff --git a/tests/test_partial_and_macros.py b/tests/test_partial_and_macros.py
index 6fd4503..3ce0a33 100644
--- a/tests/test_partial_and_macros.py
+++ b/tests/test_partial_and_macros.py
@@ -1,5 +1,6 @@
import functools
import pytest
+import re
import sys
import makefun
@@ -11,6 +12,11 @@ except ImportError:
PY2 = sys.version_info < (3, )
+# Python 3.13 dedents docstrings, earlier versions just strip initial
+# whitespace. Use a regexp to get a consistently dedented docstring
+# for comparison across Python versions.
+DOCSTRING_NORMALIZE_RE = re.compile(r"^ +", re.MULTILINE)
+
def test_doc():
def foo(x, y):
@@ -41,15 +47,15 @@ def test_doc():
sig_actual_call = ref_sig_str.replace("*, ", "")
- assert bar.__doc__ \
+ assert DOCSTRING_NORMALIZE_RE.sub("", bar.__doc__) \
== """<This function is equivalent to 'foo%s', see original 'foo' doc below.>
- a `foo` function
+a `foo` function
- :param x:
- :param y:
- :return:
- """ % sig_actual_call
+:param x:
+:param y:
+:return:
+""" % sig_actual_call
def test_partial():
@@ -78,16 +84,16 @@ def test_partial():
sig_actual_call = "(x, y='hello', a)" # if PY2 else "(x, *, y='hello', a)"
- assert foo.__doc__.replace("=KW_ONLY_ARG!", "") \
+ assert DOCSTRING_NORMALIZE_RE.sub("", foo.__doc__.replace("=KW_ONLY_ARG!", "")) \
== """<This function is equivalent to 'foo%s', see original 'foo' doc below.>
- a `foo` function
+a `foo` function
- :param x:
- :param y:
- :param a:
- :return:
- """ % sig_actual_call
+:param x:
+:param y:
+:param a:
+:return:
+""" % sig_actual_call
def test_issue_57():
@@ -127,9 +133,7 @@ def test_create_with_partial():
assert m() == -1
assert m.i == 1
# the doc remains untouched in create_function as opposed to wraps, this is normal
- assert m.__doc__ == """partial(func, *args, **keywords) - new function with partial application
- of the given arguments and keywords.
-"""
+ assert m.__doc__ == functools.partial.__doc__
def test_args_order_and_kind():

View File

@@ -0,0 +1,34 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{10..13} )
inherit distutils-r1 pypi
DESCRIPTION="Small library to dynamically create Python functions"
HOMEPAGE="
https://pypi.org/project/makefun/
https://github.com/smarie/python-makefun/
"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
BDEPEND="
dev-python/setuptools-scm[${PYTHON_USEDEP}]
"
distutils_enable_tests pytest
src_prepare() {
local PATCHES=(
# https://github.com/smarie/python-makefun/pull/104
"${FILESDIR}/${P}-test.patch"
)
distutils-r1_src_prepare
}