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', [