public async Task MemberNamesMultipleRequests(bool is3x) { using (var s = await CreateServicesAsync(null, is3x ? PythonVersions.LatestAvailable3X : PythonVersions.LatestAvailable2X, null)) using (var inspector = new PythonInspectorService(s)) { var tasks = new List <Task <ModuleMemberNamesResponse> >(); for (var i = 0; i < 10; i++) { tasks.Add(inspector.GetModuleMemberNamesAsync("thismoduledoesnotexist")); tasks.Add(inspector.GetModuleMemberNamesAsync("os.path")); } var results = await Task.WhenAll(tasks); for (var i = 0; i < results.Length; i++) { var result = results[i]; if (i % 2 == 0) { result.Should().BeNull(); } else { result.Should().NotBeNull(); } } } }
public async Task MemberNamesNotFound(bool is3x) { using (var s = await CreateServicesAsync(null, is3x ? PythonVersions.LatestAvailable3X : PythonVersions.LatestAvailable2X, null)) using (var inspector = new PythonInspectorService(s)) { var response = await inspector.GetModuleMemberNamesAsync("thismoduledoesnotexist"); response.Should().BeNull(); } }
public async Task ModuleVersionSetuptools(bool is3x) { using (var s = await CreateServicesAsync(null, is3x ? PythonVersions.LatestAvailable3X : PythonVersions.LatestAvailable2X, null)) using (var inspector = new PythonInspectorService(s)) { var version = await inspector.GetModuleVersionAsync("setuptools"); version.Should().NotBeNullOrEmpty(); } }
public async Task Cancel(bool is3x) { var token = new CancellationToken(true); using (var s = await CreateServicesAsync(null, is3x ? PythonVersions.LatestAvailable3X : PythonVersions.LatestAvailable2X, null)) using (var inspector = new PythonInspectorService(s)) { Func <Task> action = async() => { await inspector.GetModuleVersionAsync("setuptools", token); }; action.Should().Throw <OperationCanceledException>(); } }
public async Task MemberNamesOsPath(bool is3x) { using (var s = await CreateServicesAsync(null, is3x ? PythonVersions.LatestAvailable3X : PythonVersions.LatestAvailable2X, null)) using (var inspector = new PythonInspectorService(s)) { var response = await inspector.GetModuleMemberNamesAsync("os.path"); response.Should().NotBeNull(); response.Members.Should().Contain("join").And.Contain("__all__"); response.All.Should().Contain("join").And.NotContain("__all__"); } }