mirror of https://github.com/pulumi/pulumi.git
37 lines
699 B
Go
37 lines
699 B
Go
package python
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/pulumi/pulumi/pkg/v3/codegen/internal/test"
|
|
)
|
|
|
|
var pathTests = []struct {
|
|
input string
|
|
expected string
|
|
}{
|
|
{".", "."},
|
|
{"", "."},
|
|
{"../", ".."},
|
|
{"../..", "..."},
|
|
{"../../..", "...."},
|
|
{"something", ".something"},
|
|
{"../parent", "..parent"},
|
|
{"../../module", "...module"},
|
|
}
|
|
|
|
func TestRelPathToRelImport(t *testing.T) {
|
|
for _, tt := range pathTests {
|
|
t.Run(tt.input, func(t *testing.T) {
|
|
result := relPathToRelImport(tt.input)
|
|
if result != tt.expected {
|
|
t.Errorf("expected \"%s\"; got \"%s\"", tt.expected, result)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestGeneratePackage(t *testing.T) {
|
|
test.TestSDKCodegen(t, "python", GeneratePackage)
|
|
}
|