Esempio n. 1
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"));
        }
Esempio n. 2
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"));
        }
Esempio n. 3
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"));
        }
Esempio n. 4
0
        public void CanMatchImportSystemAndLoadLibraryAndWithComment()
        {
            var str = "# Write your script here.\r\nimport System.";
            var completionProvider = new IronPythonCompletionProvider();

            completionProvider.UpdateImportedTypes(str);

            Assert.AreEqual(2, completionProvider.ImportedTypes.Count);
            Assert.IsTrue(defaultImports.SequenceEqual(completionProvider.ImportedTypes.Keys.ToList()));
        }
Esempio n. 5
0
        public void DuplicateCallsToImportShouldBeFine()
        {
            var str = "\nimport System\nimport System";
            var completionProvider = new IronPythonCompletionProvider();

            completionProvider.UpdateImportedTypes(str);

            Assert.AreEqual(2, completionProvider.ImportedTypes.Count);
            Assert.IsTrue(defaultImports.SequenceEqual(completionProvider.ImportedTypes.Keys.ToList()));
        }
Esempio n. 6
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"]);
        }
Esempio n. 7
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"));
        }