summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Crosley <timothy.crosley@gmail.com>2015-08-24 00:28:50 -0700
committerTimothy Crosley <timothy.crosley@gmail.com>2015-08-24 00:28:50 -0700
commit0a63da02623822e9342bc574394027c796950902 (patch)
treeba447c1ce192a64b4f86c46df8962e941e7427ed
parentcde9d111f92f8ecefcb4a8289c73cef45ad4389c (diff)
downloadisort-feature/fix-issue-260.tar.gz
Ensure that issue 260 is fixedfeature/fix-issue-260
-rw-r--r--test_isort.py14
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')