From 23707fc57d79b986311354c91df9c3ad40cf0080 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 24 Aug 2015 07:42:48 -0400 Subject: Data dumps can be canonicalized for comparison --- coverage/debug.py | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'coverage/debug.py') diff --git a/coverage/debug.py b/coverage/debug.py index 8ae087d..8d6892b 100644 --- a/coverage/debug.py +++ b/coverage/debug.py @@ -4,9 +4,7 @@ """Control of and utilities for debugging.""" import inspect -import json import os -import re import sys @@ -100,18 +98,3 @@ def dump_stack_frames(out=None): # pragma: debugging out = out or sys.stdout out.write(short_stack()) out.write("\n") - - -def pretty_data(data): - """Format data as JSON, but as nicely as possible. - - Returns a string. - - """ - # Start with a basic JSON dump. - out = json.dumps(data, indent=4, sort_keys=True) - # But pairs of numbers shouldn't be split across lines... - out = re.sub(r"\[\s+(-?\d+),\s+(-?\d+)\s+]", r"[\1, \2]", out) - # Trailing spaces mess with tests, get rid of them. - out = re.sub(r"(?m)\s+$", "", out) - return out -- cgit v1.2.1