コード例 #1
0
        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"]);
        }
コード例 #2
0
        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"));
        }
コード例 #3
0
        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"));
        }
コード例 #4
0
        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"));
        }
コード例 #5
0
        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"));
        }