Skip to content

Commit

Permalink
Stop mutating import lines (fixes #52)
Browse files Browse the repository at this point in the history
  • Loading branch information
boxed committed Mar 1, 2019
1 parent 9d041ef commit 662762d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mutmut/__init__.py
Expand Up @@ -504,7 +504,7 @@ def mutate_node(node, context):
"""
context.stack.append(node)
try:
if node.type == 'tfpdef':
if node.type in ('tfpdef', 'import_from', 'import_name'):
return

if node.start_pos[0] - 1 != context.current_line_index:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_mutation.py
Expand Up @@ -149,13 +149,15 @@ def test_basic_mutations_python36(original, expected):
"'''foo'''", # don't mutate things we assume to be docstrings
"NotADictSynonym(a=b)",
'from foo import *',
'from .foo import *',
'import foo',
'import foo as bar',
'foo.bar',
'for x in y: pass',
'a[None]',
'a(None)',
'def foo(a, *args, **kwargs): pass',
'import foo',
]
)
def test_do_not_mutate(source):
Expand Down

0 comments on commit 662762d

Please sign in to comment.