Exemple #1
0
        public void HasImportReturnsTrueForImportedAsName()
        {
            string           code      = "import sys as something";
            ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code);

            PythonResolverContext resolverContext = new PythonResolverContext(parseInfo);

            Assert.IsTrue(resolverContext.HasImport("something"));
        }
Exemple #2
0
        public void HasImportReturnsTrueForImportThatDoesExistInCompilationUnitWithSingleUsingWithMultipleNamespaces()
        {
            string           code      = "import abc, ghi";
            ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code);

            PythonResolverContext resolverContext = new PythonResolverContext(parseInfo);

            Assert.IsTrue(resolverContext.HasImport("ghi"));
        }
Exemple #3
0
        public void HasImportReturnsFalseForFromImport()
        {
            string           code      = "from import sys";
            ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code);

            PythonResolverContext resolverContext = new PythonResolverContext(parseInfo);

            Assert.IsFalse(resolverContext.HasImport("sys"));
        }
Exemple #4
0
        public void HasImportReturnsTrueForImportThatDoesExistInCompilationUnit()
        {
            string           code      = "import abc";
            ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code);

            PythonResolverContext resolverContext = new PythonResolverContext(parseInfo);

            Assert.IsTrue(resolverContext.HasImport("abc"));
        }