github.com/databricks/cli@v0.203.0/bundle/artifacts/whl/autodetect_test.go (about)

     1  package whl
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestExtractModuleName(t *testing.T) {
    10  	moduleName := extractModuleName("./testdata/setup.py")
    11  	assert.Equal(t, "my_test_code", moduleName)
    12  }
    13  
    14  func TestExtractModuleNameMinimal(t *testing.T) {
    15  	moduleName := extractModuleName("./testdata/setup_minimal.py")
    16  	assert.Equal(t, "my_test_code", moduleName)
    17  }
    18  
    19  func TestExtractModuleNameIncorrect(t *testing.T) {
    20  	moduleName := extractModuleName("./testdata/setup_incorrect.py")
    21  	assert.Contains(t, moduleName, "artifact")
    22  }