equal
deleted
inserted
replaced
493 |
493 |
494 def verify_stdlib_on_own_line(root): |
494 def verify_stdlib_on_own_line(root): |
495 """Given some python source, verify that stdlib imports are done |
495 """Given some python source, verify that stdlib imports are done |
496 in separate statements from relative local module imports. |
496 in separate statements from relative local module imports. |
497 |
497 |
498 Observing this limitation is important as it works around an |
|
499 annoying lib2to3 bug in relative import rewrites: |
|
500 http://bugs.python.org/issue19510. |
|
501 |
|
502 >>> list(verify_stdlib_on_own_line(ast.parse('import sys, foo'))) |
498 >>> list(verify_stdlib_on_own_line(ast.parse('import sys, foo'))) |
503 [('mixed imports\\n stdlib: sys\\n relative: foo', 1)] |
499 [('mixed imports\\n stdlib: sys\\n relative: foo', 1)] |
504 >>> list(verify_stdlib_on_own_line(ast.parse('import sys, os'))) |
500 >>> list(verify_stdlib_on_own_line(ast.parse('import sys, os'))) |
505 [] |
501 [] |
506 >>> list(verify_stdlib_on_own_line(ast.parse('import foo, bar'))) |
502 >>> list(verify_stdlib_on_own_line(ast.parse('import foo, bar'))) |