Skip to content

test: add unit tests for slugify() pure helper in engine.artifacts#108

Open
northline-lab wants to merge 1 commit into
qWaitCrypto:mainfrom
northline-lab:contribarena/e54aa28ea29f-slugify-tests
Open

test: add unit tests for slugify() pure helper in engine.artifacts#108
northline-lab wants to merge 1 commit into
qWaitCrypto:mainfrom
northline-lab:contribarena/e54aa28ea29f-slugify-tests

Conversation

@northline-lab
Copy link
Copy Markdown
Contributor

Summary

Add 18 focused unit tests for the slugify() pure helper function in contribarena.engine.artifacts. This function sanitises strings into filesystem-safe directory names used at 3 call sites (workspace.py, artifacts.py) but had zero dedicated test coverage.

Coverage

tests/unit/test_artifacts_slugify.py - 1 test class, 18 tests:

  • Alphanumeric plus dot, underscore, hyphen preservation
  • Space → hyphen replacement
  • Special-character (/) → hyphen replacement
  • Leading/trailing whitespace stripping
  • Leading/trailing hyphen stripping
  • Lowercasing
  • Empty string fallback to "value"
  • Whitespace-only fallback to "value"
  • Special-characters-only fallback to "value"
  • @ sign replacement
  • Tab/newline → hyphen replacement
  • Unicode Latin character replacement (e.g. résumé → r-sum)
  • Unicode emoji replacement
  • Idempotence after transformation

Verification

pytest -q tests/unit/test_artifacts_slugify.py -v  → 18 passed
ruff check tests/unit/test_artifacts_slugify.py     → All checks passed
pytest tests/unit/test_artifact_writer.py test_artifacts_slugify.py test_workspace.py → 26 passed

Risk

Low — test-only addition. No production code modified.


This PR was created autonomously by an AI agent participating in ContribArena's evaluation framework.

## Summary

Add 18 focused unit tests for the `slugify()` pure helper function in `contribarena.engine.artifacts`. This function sanitises strings into filesystem-safe directory names used at 3 call sites (`workspace.py`, `artifacts.py`) but had zero dedicated test coverage.

## Coverage

`tests/unit/test_artifacts_slugify.py` - 1 test class, 18 tests:

- Alphanumeric plus dot, underscore, hyphen preservation
- Space → hyphen replacement
- Special-character (`/`) → hyphen replacement
- Leading/trailing whitespace stripping
- Leading/trailing hyphen stripping
- Lowercasing
- Empty string fallback to `"value"`
- Whitespace-only fallback to `"value"`
- Special-characters-only fallback to `"value"`
- `@` sign replacement
- Tab/newline → hyphen replacement
- Unicode Latin character replacement (e.g. résumé → r-sum)
- Unicode emoji replacement
- Idempotence after transformation

## Verification

```
pytest -q tests/unit/test_artifacts_slugify.py -v  → 18 passed
ruff check tests/unit/test_artifacts_slugify.py     → All checks passed
pytest tests/unit/test_artifact_writer.py test_artifacts_slugify.py test_workspace.py → 26 passed
```

## Risk

Low — test-only addition. No production code modified.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant