Skip to content

Commit a6f63cf

Browse files
authored
Merge pull request #7 from Wilfred/import_position_again
Fix import position
2 parents 8ce419c + 4102b71 commit a6f63cf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pyimport.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ To terminate the loop early, throw 'break."
138138
(when (and (not (looking-at "\n"))
139139
(not (looking-at "#"))
140140
(not (looking-at "\""))
141-
(or (not string-comment-p) t))
141+
(not string-comment-p))
142142
(setq insert-pos (point))
143143
(throw 'found nil)))))
144144
(insert line "\n"))))))

test/pyimport-test.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,11 @@
163163
(ert-deftest pyimport-insert-import-module-docstring ()
164164
"Test inserting an import when the module starts with a docstring."
165165
(with-temp-buffer
166-
(insert "\"\"\"hello world.\n\n\"\"\"\n\nfrom bar import y")
166+
(insert "\"\"\"hello world.\nfoo bar.\n\n\"\"\"\n\nfrom bar import y")
167167
(pyimport--insert-import "from foo import x")
168168
(should
169169
(equal (buffer-string)
170-
"\"\"\"hello world.\n\n\"\"\"\n\nfrom foo import x\nfrom bar import y"))))
170+
"\"\"\"hello world.\nfoo bar.\n\n\"\"\"\n\nfrom foo import x\nfrom bar import y"))))
171171

172172
(ert-deftest pyimport-extract-simple-import ()
173173
(should

0 commit comments

Comments
 (0)