From e977c6671a470d431ffe869069d95692e846d261 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Sat, 9 Jul 2016 20:26:08 -0500 Subject: [PATCH] Update tests for errors with no physical line --- tests/unit/test_base_formatter.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_base_formatter.py b/tests/unit/test_base_formatter.py index dc4a95c..f148806 100644 --- a/tests/unit/test_base_formatter.py +++ b/tests/unit/test_base_formatter.py @@ -51,7 +51,15 @@ def test_show_source_returns_nothing_when_not_showing_source(): formatter = base.BaseFormatter(options(show_source=False)) assert formatter.show_source( style_guide.Error('A000', 'file.py', 1, 1, 'error text', 'line') - ) is None + ) is '' + + +def test_show_source_returns_nothing_when_there_is_source(): + """Ensure we return nothing when there is no line.""" + formatter = base.BaseFormatter(options(show_source=True)) + assert formatter.show_source( + style_guide.Error('A000', 'file.py', 1, 1, 'error text', None) + ) is '' @pytest.mark.parametrize('line, column', [