Skip to content

Commit

Permalink
_pformat_dispatch: pass through args (#6715)
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed authored Feb 12, 2020
1 parent d79179a commit b7ad4c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/_pytest/_io/saferepr.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ def _format(self, object, stream, indent, allowance, context, level):

def _pformat_dispatch(object, indent=1, width=80, depth=None, *, compact=False):
return AlwaysDispatchingPrettyPrinter(
indent=1, width=80, depth=None, compact=False
indent=indent, width=width, depth=depth, compact=compact
).pformat(object)
7 changes: 7 additions & 0 deletions testing/io/test_saferepr.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
from _pytest._io.saferepr import _pformat_dispatch
from _pytest._io.saferepr import saferepr


Expand Down Expand Up @@ -147,3 +148,9 @@ def test_unicode():
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')"

0 comments on commit b7ad4c2

Please sign in to comment.