Skip to main content
Glama
python.test.ts1.99 kB
import { LanguageTestSuite, type LanguageConfig } from '../../base/index.js'; import { test } from 'vitest'; import { assertSymbolInspection } from '../../base/index.js'; class PythonTestSuite extends LanguageTestSuite { constructor() { const config: LanguageConfig = { name: 'Python', testProjectPath: 'test/integration/languages/python/test-project', mainFile: 'main.py', testPosition: { file: '', line: 1, character: 1 }, // Will be set by getMainFilePath() expectDiagnostics: true, customTests: () => { // Python-specific tests test('Should detect Python syntax errors', async () => { const result = await this.client.getDiagnostics( this.getMainFilePath() ); // Just verify we get some diagnostics (Python LSP may not be fully configured) this.assertToolResult(result); }); test('Should inspect Python function', async () => { const result = await this.client.inspect({ file: this.getMainFilePath(), line: 1, // def main(): character: 5, // on "main" }); assertSymbolInspection(result, { symbolName: 'main', // Skip type assertion as different LSPs may format differently }); }); test('Should find Python symbols', async () => { const result = await this.client.searchSymbols('main'); this.assertToolResult(result); this.assertSymbolExists(result, 'main'); }); test('Should read Python file symbols', async () => { const result = await this.client.outline( this.getMainFilePath(), true ); this.assertToolResult(result); this.assertSymbolExists(result, 'main'); }); }, }; super(config); } } // Create and run the test suite const pythonSuite = new PythonTestSuite(); pythonSuite.createTestSuite();

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/p1va/symbols-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server