Repository navigation
Closed
Description
This seems to be just a very trivial formatting difference:
=================================== FAILURES ===================================
___________________________________ test_doc ___________________________________
def test_doc():
def foo(x, y):
"""
a `foo` function
:param x:
:param y:
:return:
"""
return x + y
ref_bar = functools.partial(foo, x=12)
ref_sig_str = "(x=12, y)" if PY2 else "(*, x=12, y)"
assert str(signature(ref_bar)) == ref_sig_str
bar = makefun.partial(foo, x=12)
# same behaviour - except in python 2 where our "KW_ONLY_ARG!" appear
assert str(signature(bar)).replace("=KW_ONLY_ARG!", "") == str(signature(ref_bar))
bar.__name__ = 'bar'
help(bar)
with pytest.raises(TypeError):
bar(1)
assert bar(y=1) == 13
sig_actual_call = ref_sig_str.replace("*, ", "")
> assert bar.__doc__ \
== """<This function is equivalent to 'foo%s', see original 'foo' doc below.>
a `foo` function
:param x:
:param y:
:return:
""" % sig_actual_call
E assert "<This function is equivalent to 'foo(x=12, y)', see original 'foo' doc below.>\n\na `foo` function\n\n:param x:\n:param y:\n:return:\n" == "<This function is equivalent to 'foo(x=12, y)', see original 'foo' doc below.>\n\n a `foo` function\n\n :param x:\n :param y:\n :return:\n "
E <This function is equivalent to 'foo(x=12, y)', see original 'foo' doc below.>
E
E - a `foo` function
E ? --------
E + a `foo` function
E
E + :param x:
E + :param y:
E + :return:
E - :param x:
E - :param y:
E - :return:
E -
tests/test_partial_and_macros.py:44: AssertionError
----------------------------- Captured stdout call -----------------------------
Help on function bar in module tests.test_partial_and_macros:
bar(*, x=12, y)
<This function is equivalent to 'foo(x=12, y)', see original 'foo' doc below.>
a `foo` function
:param x:
:param y:
:return:
_________________________________ test_partial _________________________________
def test_partial():
"""Tests that `with_partial` works"""
@makefun.with_partial(y='hello')
def foo(x, y, a):
"""
a `foo` function
:param x:
:param y:
:param a:
:return:
"""
print(a)
print(x, y)
if not PY2:
# true keyword-only
with pytest.raises(TypeError):
foo(1, 2)
foo(1, a=2)
help(foo)
sig_actual_call = "(x, y='hello', a)" # if PY2 else "(x, *, y='hello', a)"
> assert foo.__doc__.replace("=KW_ONLY_ARG!", "") \
== """<This function is equivalent to 'foo%s', see original 'foo' doc below.>
a `foo` function
:param x:
:param y:
:param a:
:return:
""" % sig_actual_call
E assert "<This function is equivalent to 'foo(x, y='hello', a)', see original 'foo' doc below.>\n\na `foo` function\n\n:param x:\n:param y:\n:param a:\n:return:\n" == "<This function is equivalent to 'foo(x, y='hello', a)', see original 'foo' doc below.>\n\n a `foo` function\n\n :param x:\n :param y:\n :param a:\n :return:\n "
E <This function is equivalent to 'foo(x, y='hello', a)', see original 'foo' doc below.>
E
E - a `foo` function
E ? --------
E + a `foo` function
E
E + :param x:
E + :param y:
E + :param a:
E + :return:
E - :param x:
E - :param y:
E - :param a:
E - :return:
E -
tests/test_partial_and_macros.py:81: AssertionError
----------------------------- Captured stdout call -----------------------------
This is with python3-3.13.0~b2-3.fc41.x86_64.
Downstream bug report: https://bugzilla.redhat.com/show_bug.cgi?id=2245884.
That also has replication instructions for the environment.
Metadata
Metadata
Assignees
Labels
No labels
Activity
keszybz commentedon Jun 10, 2024
And some more…
mweinelt commentedon Jun 17, 2024
And now also on Python 3.12.4.
Fix tests with Python 3.13
Added python 3.13 in the CI. See #102
mgorny commentedon Jul 12, 2024
Thank you!