public override IDictionary <string, IAnalysisSet> GetAllMembers(IModuleContext moduleContext, GetMemberOptions options = GetMemberOptions.None) { if (_original == null) { return(base.GetAllMembers(moduleContext, options)); } return(_original.GetAllMembers(moduleContext, options)); }
public override IDictionary <string, IAnalysisSet> GetAllMembers(IModuleContext moduleContext) { if (_original == null) { return(base.GetAllMembers(moduleContext)); } return(_original.GetAllMembers(moduleContext)); }
private static IEnumerable <KeyValuePair <string, IAnalysisSet> > GetTestCaseMembers( IPythonProjectEntry entry, AnalysisValue classValue ) { return(classValue.GetAllMembers(entry.Analysis.InterpreterContext) .Where(v => v.Key.StartsWith("test")) .Where(v => v.Value.Any(m => m.MemberType == PythonMemberType.Function || m.MemberType == PythonMemberType.Method))); }
/// <summary> /// Get Test Case Members for a class. If the class has 'test*' tests /// return those. If there aren't any 'test*' tests return (if one at /// all) the runTest overridden method /// </summary> private static IEnumerable <KeyValuePair <string, IAnalysisSet> > GetTestCaseMembers( IPythonProjectEntry entry, AnalysisValue classValue ) { var methodFunctions = classValue.GetAllMembers(entry.Analysis.InterpreterContext) .Where(v => v.Value.Any(m => m.MemberType == PythonMemberType.Function || m.MemberType == PythonMemberType.Method)); var tests = methodFunctions.Where(v => v.Key.StartsWith("test")); var runTest = methodFunctions.Where(v => v.Key.Equals("runTest")); if (tests.Any()) { return(tests); } else { return(runTest); } }
/// <summary> /// Get Test Case Members for a class. If the class has 'test*' tests /// return those. If there aren't any 'test*' tests return (if one at /// all) the runTest overridden method /// </summary> private static IEnumerable <KeyValuePair <string, LocationInfo> > GetTestCaseMembers( PythonAst ast, string sourceFile, Uri documentUri, ModuleAnalysis analysis, AnalysisValue classValue ) { IEnumerable <KeyValuePair <string, LocationInfo> > tests = null, runTest = null; if (ast != null && !string.IsNullOrEmpty(sourceFile)) { var walker = new TestMethodWalker(ast, sourceFile, documentUri, classValue.Locations); ast.Walk(walker); tests = walker.Methods.Where(v => v.Key.StartsWithOrdinal("test")); runTest = walker.Methods.Where(v => v.Key.Equals("runTest")); } var methodFunctions = classValue.GetAllMembers(analysis.InterpreterContext) .Where(v => v.Value.Any(m => m.MemberType == PythonMemberType.Function || m.MemberType == PythonMemberType.Method)) .Select(v => new KeyValuePair <string, LocationInfo>(v.Key, v.Value.SelectMany(av => av.Locations).FirstOrDefault(l => l != null))); var analysisTests = methodFunctions.Where(v => v.Key.StartsWithOrdinal("test")); var analysisRunTest = methodFunctions.Where(v => v.Key.Equals("runTest")); tests = tests?.Concat(analysisTests) ?? analysisTests; runTest = runTest?.Concat(analysisRunTest) ?? analysisRunTest; if (tests.Any()) { return(tests); } else { return(runTest); } }
/// <summary> /// Get Test Case Members for a class. If the class has 'test*' tests /// return those. If there aren't any 'test*' tests return (if one at /// all) the runTest overridden method /// </summary> private static IEnumerable<KeyValuePair<string, IAnalysisSet>> GetTestCaseMembers( ModuleAnalysis analysis, AnalysisValue classValue ) { var methodFunctions = classValue.GetAllMembers(analysis.InterpreterContext) .Where(v => v.Value.Any(m => m.MemberType == PythonMemberType.Function || m.MemberType == PythonMemberType.Method)); var tests = methodFunctions.Where(v => v.Key.StartsWith("test")); var runTest = methodFunctions.Where(v => v.Key.Equals("runTest")); if (tests.Any()) { return tests; } else { return runTest; } }
public override IDictionary <string, IAnalysisSet> GetAllMembers(IModuleContext moduleContext, GetMemberOptions options = GetMemberOptions.None) => _actualType.GetAllMembers(moduleContext, options);