diff options
-rw-r--r-- | test_isort.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test_isort.py b/test_isort.py index c8a81dd6..c1d194da 100644 --- a/test_isort.py +++ b/test_isort.py @@ -1485,3 +1485,17 @@ def test_comments_not_duplicated(): output = SortImports(file_contents=test_input).output assert output.count("# Whole line comment\n") == 1 assert output.count("# inline comment\n") == 1 + + +def test_top_of_line_comments(): + """Test to ensure top of line comments stay where they should: issue 260""" + test_input = ('# -*- coding: utf-8 -*-\n' + 'from django.db import models\n' + '#import json as simplejson\n' + 'from myproject.models import Servidor\n' + '\n' + 'import reversion\n' + '\n' + 'import logging\n') + output = SortImports(file_contents=test_input).output + assert output.startswith('# -*- coding: utf-8 -*-\n') |