def test_should_return_undefined_symbols(self): self.assertEqual(findundefined.find_undefined ("import os\n" "os.path.join()\n" "shutil.rmtree\n" "shutil = 1"), ["shutil.rmtree"])
def _autoimport_add_imports(source): modules = [] for name in findundefined.find_undefined(source): module = find_module_for(name) if module: modules.append(module) if modules: return add_imports(source, sorted(set(modules))) else: return None
def test_should_return_undefined_symbols(self): self.assertEqual( findundefined.find_undefined("import os\n" "os.path.join()\n" "shutil.rmtree\n" "shutil = 1"), ["shutil.rmtree"])
def test_should_not_return_duplicates(self): self.assertEqual( findundefined.find_undefined("sys.argv[1]\n" "sys.argv[2]\n"), ["sys.argv"])
def test(self): self.assertEqual( findundefined.find_undefined("import os\n" "os.path.join()\n" "shutil.rmtree\n" "shutil = 1"), ["shutil.rmtree"], )
def test_should_not_return_duplicates(self): self.assertEqual(findundefined.find_undefined ("sys.argv[1]\n" "sys.argv[2]\n"), ["sys.argv"])