diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-01-24 09:24:36 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-01-24 09:24:36 -0500 |
commit | 70818633d97eabd24bfde567a61a684f044ed54d (patch) | |
tree | f3797e523f6dd36032c5a39240adc5e8ea4a8782 | |
parent | d11501498ec4651a45f674cb2c35f36fd93f9eb5 (diff) | |
download | python-coveragepy-70818633d97eabd24bfde567a61a684f044ed54d.tar.gz |
info_formatter shouldn't assume it gets a list
-rw-r--r-- | coverage/debug.py | 1 | ||||
-rw-r--r-- | tests/test_debug.py | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/coverage/debug.py b/coverage/debug.py index 6e7af24..c441dff 100644 --- a/coverage/debug.py +++ b/coverage/debug.py @@ -41,6 +41,7 @@ def info_formatter(info): nicely formatted, ready to print. """ + info = list(info) label_len = max(len(l) for l, _d in info) for label, data in info: if data == []: diff --git a/tests/test_debug.py b/tests/test_debug.py index 33bca44..8aad925 100644 --- a/tests/test_debug.py +++ b/tests/test_debug.py @@ -31,6 +31,10 @@ class InfoFormatterTest(CoverageTest): ' nothing: -none-', ]) + 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']) + class DebugTraceTest(CoverageTest): """Tests of debug output.""" |