public void GetModulesThatImportEverythingReturnsSysForFromSysImportAllStatement() { string code = "from sys import *"; ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); string[] expectedModules = new string[] { "sys" }; Assert.AreEqual(expectedModules, resolverContext.GetModulesThatImportEverything()); }
public void GetModulesThatImportEverythingReturnsEmptyCollectionIfNotImportAll() { string code = "from math import tan"; ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); string[] expectedModules = new string[0]; Assert.AreEqual(expectedModules, resolverContext.GetModulesThatImportEverything()); }
public void GetModulesThatImportEverythingIgnoresNonFromImportStatement() { string code = "import math\r\n" + "from sys import *"; ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); string[] expectedModules = new string[] { "sys" }; Assert.AreEqual(expectedModules, resolverContext.GetModulesThatImportEverything()); }