def test_import_invalid_module():
 invalid_module_names = {'foo-bar', 'foo:bar', '10foo'}
 valid_module_names = {'foobar'}
 with TemporaryDirectory() as tmpdir:
  sys.path.insert(0, tmpdir)
  for name in (invalid_module_names | valid_module_names):
   filename = os.path.join(tmpdir, (name + '.py'))
   open(filename, 'w').close()
  s = set(module_completion('import foo'))
  intersection = s.intersection(invalid_module_names)
  nt.assert_equal(intersection, set())
  assert valid_module_names.issubset(s), valid_module_names.intersection(s)

def test_import_invalid_module ( ) : invalid_module_names = { 'foo-bar' , 'foo:bar' , '10foo' } valid_module_names = { 'foobar' } with TemporaryDirectory ( ) as tmpdir : sys . path . insert ( 0 , tmpdir ) for name in ( invalid_module_names | valid_module_names ) : filename = os . path . join ( tmpdir , ( name + '.py' ) ) open ( filename , 'w' ) . close ( ) s = set ( module_completion ( 'import foo' ) ) intersection = s . intersection ( invalid_module_names ) nt . assert_equal ( intersection , set ( ) ) assert valid_module_names . issubset ( s ) , valid_module_names . intersection ( s )
testing of issue URL .