public void CanFindSystemCollectionsAssignmentAndType() { var str = "from System.Collections import ArrayList\na = ArrayList()\n"; var completionProvider = new IronPythonCompletionProvider(); completionProvider.UpdateImportedTypes(str); completionProvider.UpdateVariableTypes(str); Assert.IsTrue(completionProvider.VariableTypes.ContainsKey("a")); Assert.AreEqual(typeof(System.Collections.ArrayList), completionProvider.VariableTypes["a"]); }
public void CanFindDifferentTypesOfImportsAndLoad() { var str = "from itertools import *\nimport math\nfrom sys import callstats\n"; var completionProvider = new IronPythonCompletionProvider(); completionProvider.UpdateImportedTypes(str); Assert.AreEqual(3, completionProvider.ImportedTypes.Count); Assert.IsTrue(completionProvider.Scope.ContainsVariable("repeat")); Assert.IsTrue(completionProvider.Scope.ContainsVariable("izip")); Assert.IsTrue(completionProvider.Scope.ContainsVariable("math")); Assert.IsTrue(completionProvider.Scope.ContainsVariable("callstats")); }
public void DuplicateCallsToImportShouldBeFine() { var str = "\nimport System\nimport System"; var completionProvider = new IronPythonCompletionProvider(); completionProvider.UpdateImportedTypes(str); Assert.AreEqual(1, completionProvider.ImportedTypes.Count); Assert.IsTrue(completionProvider.ImportedTypes.ContainsKey("System")); }
public void CanMatchImportSystemAndLoadLibraryAndWithComment() { var str = "# Write your script here.\r\nimport System."; var completionProvider = new IronPythonCompletionProvider(); completionProvider.UpdateImportedTypes(str); Assert.AreEqual(1, completionProvider.ImportedTypes.Count); Assert.IsTrue(completionProvider.ImportedTypes.ContainsKey("System")); }
public void CanImportLibrary() { var str = "\nimport System\n"; var completionProvider = new IronPythonCompletionProvider(); completionProvider.UpdateImportedTypes(str); Assert.AreEqual(1, completionProvider.ImportedTypes.Count); Assert.IsTrue(completionProvider.ImportedTypes.ContainsKey("System")); }