summaryrefslogtreecommitdiff
path: root/tests/test_debug.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2019-12-29 11:23:57 -0500
committerNed Batchelder <ned@nedbatchelder.com>2019-12-29 11:23:57 -0500
commit129e5616783a1a12fb08fe42f0c0c478e5177da2 (patch)
tree1fdd92292e1b98009f719382cfb88662b015fd0b /tests/test_debug.py
parent903d2de43ac8c3d9d8ac081bc30d834f3894052d (diff)
downloadpython-coveragepy-git-129e5616783a1a12fb08fe42f0c0c478e5177da2.tar.gz
Use a fixed width for info labels
It makes it look nicer when using --debug=config,sys and it makes it easier to compare output between two different versions.
Diffstat (limited to 'tests/test_debug.py')
-rw-r--r--tests/test_debug.py32
1 files changed, 21 insertions, 11 deletions
diff --git a/tests/test_debug.py b/tests/test_debug.py
index e3b929f6..228e33b0 100644
--- a/tests/test_debug.py
+++ b/tests/test_debug.py
@@ -18,7 +18,7 @@ from tests.helpers import re_line, re_lines
class InfoFormatterTest(CoverageTest):
- """Tests of misc.info_formatter."""
+ """Tests of debug.info_formatter."""
run_in_temp_dir = False
@@ -29,19 +29,29 @@ class InfoFormatterTest(CoverageTest):
('regular', ['abc', 'def', 'ghi', 'jkl']),
('nothing', []),
]))
- self.assertEqual(lines, [
- ' x: hello there',
- 'very long label: one element',
- ' regular: abc',
- ' def',
- ' ghi',
- ' jkl',
- ' nothing: -none-',
- ])
+ expected = [
+ ' x: hello there',
+ ' very long label: one element',
+ ' regular: abc',
+ ' def',
+ ' ghi',
+ ' jkl',
+ ' nothing: -none-',
+ ]
+ self.assertEqual(expected, lines)
def test_info_formatter_with_generator(self):
lines = list(info_formatter(('info%d' % i, i) for i in range(3)))
- self.assertEqual(lines, ['info0: 0', 'info1: 1', 'info2: 2'])
+ expected = [
+ ' info0: 0',
+ ' info1: 1',
+ ' info2: 2',
+ ]
+ self.assertEqual(expected, lines)
+
+ def test_too_long_label(self):
+ with self.assertRaises(AssertionError):
+ list(info_formatter([('this label is way too long and will not fit', 23)]))
@pytest.mark.parametrize("label, header", [