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)
| 511 | // listing exact rules. We verify documented invariants only: non-identifier |
| 512 | // characters are replaced with underscores and identifiers can be used safely. |
| 513 | func 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. |
nothing calls this directly
no test coverage detected