_pformat_dispatch: pass through args (#6715)
This commit is contained in:
parent
d79179a239
commit
b7ad4c2bed
|
@ -99,5 +99,5 @@ class AlwaysDispatchingPrettyPrinter(pprint.PrettyPrinter):
|
||||||
|
|
||||||
def _pformat_dispatch(object, indent=1, width=80, depth=None, *, compact=False):
|
def _pformat_dispatch(object, indent=1, width=80, depth=None, *, compact=False):
|
||||||
return AlwaysDispatchingPrettyPrinter(
|
return AlwaysDispatchingPrettyPrinter(
|
||||||
indent=1, width=80, depth=None, compact=False
|
indent=indent, width=width, depth=depth, compact=compact
|
||||||
).pformat(object)
|
).pformat(object)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
from _pytest._io.saferepr import _pformat_dispatch
|
||||||
from _pytest._io.saferepr import saferepr
|
from _pytest._io.saferepr import saferepr
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,3 +148,9 @@ def test_unicode():
|
||||||
val = "£€"
|
val = "£€"
|
||||||
reprval = "'£€'"
|
reprval = "'£€'"
|
||||||
assert saferepr(val) == reprval
|
assert saferepr(val) == reprval
|
||||||
|
|
||||||
|
|
||||||
|
def test_pformat_dispatch():
|
||||||
|
assert _pformat_dispatch("a") == "'a'"
|
||||||
|
assert _pformat_dispatch("a" * 10, width=5) == "'aaaaaaaaaa'"
|
||||||
|
assert _pformat_dispatch("foo bar", width=5) == "('foo '\n 'bar')"
|
||||||
|
|
Loading…
Reference in New Issue