MCPcopy Index your code
hub / github.com/github/gh-aw / TestSpec_PublicAPI_SanitizePythonVariableName

Function TestSpec_PublicAPI_SanitizePythonVariableName

pkg/stringutil/spec_test.go:513–525  ·  view source on GitHub ↗

TestSpec_PublicAPI_SanitizePythonVariableName validates the documented behavior of SanitizePythonVariableName as described in the package README.md. Specification: "Sanitizes a string for use as a Python variable name. Similar to SanitizeParameterName but follows Python identifier rules." SPEC_AMB

(t *testing.T)

Source from the content-addressed store, hash-verified

511// listing exact rules. We verify documented invariants only: non-identifier
512// characters are replaced with underscores and identifiers can be used safely.
513func TestSpec_PublicAPI_SanitizePythonVariableName(t *testing.T) {
514 t.Run("replaces non-identifier characters with underscores", func(t *testing.T) {
515 result := SanitizePythonVariableName("foo-bar.baz")
516 assert.Equal(t, "foo_bar_baz", result,
517 "non-identifier characters should be replaced with underscores")
518 })
519
520 t.Run("preserves letters digits and underscores", func(t *testing.T) {
521 result := SanitizePythonVariableName("valid_name123")
522 assert.Equal(t, "valid_name123", result,
523 "valid Python identifier characters should be preserved")
524 })
525}
526
527// TestSpec_PublicAPI_SanitizeToolID validates the documented behavior of
528// SanitizeToolID as described in the package README.md.

Callers

nothing calls this directly

Calls 2

RunMethod · 0.45

Tested by

no test coverage detected