123456789101112131415161718192021222324252627282930313233343536373839 |
- package python
- import "testing"
- // TestPython tests the Python stack analysis functionality.
- // It checks if the Name method returns the correct stack name
- func TestPython(t *testing.T) {
- // Create a new Python stack instance
- pythonStack := &Python{}
- // Test the Name method
- expectedName := "Python"
- if pythonStack.Name() != expectedName {
- t.Errorf("Expected name %s, got %s", expectedName, pythonStack.Name())
- }
- // Test the Analyze method with a sample codebase path
- codebasePath := "/path/to/python/project"
- stackName, err := pythonStack.Analyze(codebasePath)
- if err != nil {
- t.Errorf("Unexpected error during analysis: %v", err)
- }
- if stackName != expectedName {
- t.Errorf("Expected stack name %s, got %s", expectedName, stackName)
- }
- }
- // TestPythonAnalyzeError tests the Analyze method for error handling.
- func TestPythonAnalyzeError(t *testing.T) {
- // Create a new Python stack instance
- pythonStack := &Python{}
- // Test the Analyze method with an invalid codebase path
- invalidPath := "/invalid/path/to/python/project"
- _, err := pythonStack.Analyze(invalidPath)
- if err == nil {
- t.Error("Expected an error for invalid codebase path, got nil")
- }
- }
|