summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Crosley <timothy.crosley@gmail.com>2019-10-09 23:44:16 -0700
committerTimothy Crosley <timothy.crosley@gmail.com>2019-10-09 23:44:16 -0700
commitca031619b00560e35b160df5db802c90ec374db5 (patch)
tree0347e85573e76f51b9e99851e7167d18e096998e
parentcb9254a3c89c51562baad630d08857d681ecde17 (diff)
parent0ebef18c7a6cfdee9c504d1a3ea3f5472843fe6d (diff)
downloadisort-ca031619b00560e35b160df5db802c90ec374db5.tar.gz
Merge branch 'develop' of https://github.com/timothycrosley/isort into develop
-rw-r--r--test_isort.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/test_isort.py b/test_isort.py
index 9cddb681..1a833aca 100644
--- a/test_isort.py
+++ b/test_isort.py
@@ -4307,6 +4307,31 @@ def test_pyi_formatting_issue_942(tmpdir) -> None:
)
+def test_move_class_issue_751() -> None:
+ test_input = (
+ "# -*- coding: utf-8 -*-"
+ "\n"
+ "# Define your item pipelines here"
+ "#"
+ "# Don't forget to add your pipeline to the ITEM_PIPELINES setting"
+ "# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html"
+ "from datetime import datetime"
+ "from .items import WeiboMblogItem"
+ "\n"
+ "class WeiboMblogPipeline(object):"
+ " def process_item(self, item, spider):"
+ " if isinstance(item, WeiboMblogItem):"
+ " item = self._process_item(item, spider)"
+ " return item"
+ "\n"
+ " def _process_item(self, item, spider):"
+ " item['inserted_at'] = datetime.now()"
+ " return item"
+ "\n"
+ )
+ assert SortImports(file_contents=test_input).output == test_input
+
+
def test_python_version() -> None:
from isort.main import parse_args