Issue #23 new

Truncate long repr() objects in assertions

Kumar McMillan
repo owner created an issue

Objects that produce long str() or repr() should be truncated. Example: {{{

!python

AssertionError: fake:mkt.inapp_pay.models.inapp_cef.log(arg.any(), 'unknown', 'inapp_pay_error', arg.passes_test(<function inspect_msg at 0x106...)) was called unexpectedly with args (<WSGIRequest GET:<QueryDict: {u'req': [u'eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.IntcImF1ZFwiOiBcIm1hcmtldHBsYWNlLm1vemlsbGEub3JnXCIsIFwiaXNzXCI6IFwiMEwxNEpENjBITldOUEcyUEFEVTNcIiwgXCJyZXF1ZXN0XCI6IHtcImN1cnJlbmN5XCI6IFwiVVNEXCIsIFwicHJpY2VcIjogXCIwLjk5XCIsIFwibmFtZVwiOiBcIk15IGJhbmRzIGxhdGVzdCBhbGJ1bVwiLCBcInByb2R1Y3RkYXRhXCI6IFwibXlfcHJvZHVjdF9pZD0xMjM0XCIsIFwiZGVzY3JpcHRpb25cIjogXCIzMjBrYnBzIE1QMyBkb3dubG9hZCwgRFJNIGZyZWUhXCJ9LCBcImV4cFwiOiAxMzM5MTk4MTE4LCBcImlhdFwiOiAxMzM5MTk0NTE4LCBcInR5cFwiOiBcIm1vemlsbGEvcGF5bWVudHMvcGF5L3YxXCJ9Ig.kEtOJeXq-nY34M9wq_MQomYYszbws8_gLVkYagD7HVA']}>, POST:<QueryDict: {}>, COOKIES:{'sessionid': '8ea312374883773a3d2817f3bd8fced2'}, META:{'CONTENT_TYPE': 'text/html; charset=utf-8', 'HTTP_COOKIE': ' sessionid=8ea312374883773a3d2817f3bd8fced2; Domain=None; expires=None; Max-Age=None; Path=/; secure', 'PATH_INFO': u'/en-US/inapp-pay/pay_start', 'QUERY_STRING': 'req=eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.IntcImF1ZFwiOiBcIm1hcmtldHBsYWNlLm1vemlsbGEub3JnXCIsIFwiaXNzXCI6IFwiMEwxNEpENjBITldOUEcyUEFEVTNcIiwgXCJyZXF1ZXN0XCI6IHtcImN1cnJlbmN5XCI6IFwiVVNEXCIsIFwicHJpY2VcIjogXCIwLjk5XCIsIFwibmFtZVwiOiBcIk15IGJhbmRzIGxhdGVzdCBhbGJ1bVwiLCBcInByb2R1Y3RkYXRhXCI6IFwibXlfcHJvZHVjdF9pZD0xMjM0XCIsIFwiZGVzY3JpcHRpb25cIjogXCIzMjBrYnBzIE1QMyBkb3dubG9hZCwgRFJNIGZyZWUhXCJ9LCBcImV4cFwiOiAxMzM5MTk4MTE4LCBcImlhdFwiOiAxMzM5MTk0NTE4LCBcInR5cFwiOiBcIm1vemlsbGEvcGF5bWVudHMvcGF5L3YxXCJ9Ig.kEtOJeXq-nY34M9wq_MQomYYszbws8_gLVkYagD7HVA', 'REMOTE_ADDR': '127.0.0.1', 'REQUEST_METHOD': 'GET', 'SCRIPT_NAME': u'', 'SERVER_NAME': 'testserver', 'SERVER_PORT': '80', 'SERVER_PROTOCOL': 'HTTP/1.1', 'wsgi.errors': <cStringIO.StringO object at 0x1069bb998>, 'wsgi.input': <django.test.client.FakePayload object at 0x106ba6cd0>, 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)}>, 'unknown', 'inapp_pay_error', 'Encountered error or exception during in-app payment flow: RequestVerificationError', severity=4) }}}

Comments (0)

  1. Log in to comment