← Back to issue list

test: unit tests for control encoder and model

View original Github issue

Metadata

Project
debcraft
Number
#55
Type
pull request
State
open
Author
Copilot
Labels
Created
2025-11-27 22:56:02+00:00
Updated
2025-12-06 16:17:39+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

- [x] Have you followed the guidelines for contributing? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] Have you successfully run `make lint && make test`? --- Addresses review feedback from #54 requesting unit test coverage for the control file encoding logic. ### Changes - **`tests/unit/models/test_control_model.py`**: Tests for `DebianControl` model and `_field_alias` function - Field alias generation (snake_case → Debian-Control-Format) - Model creation, optional field defaults, architecture as list - **`tests/unit/debcraft/test_control.py`**: Tests for `Encoder` class - Simple field encoding - Multi-line string handling with continuation lines - Empty lines replaced with ` .` - List fields as comma-separated values - None fields excluded from output ### Example ```python from debcraft.models.control import _field_alias # Field alias conversion _field_alias("installed_size") # → "Installed-Size" _field_alias("original_maintainer") # → "Original-Maintainer" ``` 21 new tests added. <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/canonical/debcraft/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.

Evaluation history

No evaluation history available.