#NEWLINE# def test_parse_imports( index ) : #NEWLINE# #INDENT# src = dedent ( '\n        import os, sys as sys\n        import sys as sys\n        from os.path import basename\n\n        from os import (\n            path,\n            posixpath\n            )\n\n        def main():\n            pass\n        ' ) . strip ( ) #NEWLINE# ( unresolved , unreferenced ) = Scope . from_source ( src ) . find_unresolved_and_unreferenced_symbols ( ) #NEWLINE# new_src = update_imports ( src , index , index , unreferenced ) #NEWLINE# assert ( dedent ( '\n        def main():\n            pass\n        ' ) . strip ( ) == new_src . strip ( ) )