Pinning parse_tags before the refactor
builds on: Refactors that quietly change behavior, What makes a test able to fail
The current code splits on commas, strips and lowercases each tag, and skips blanks and repeats, keeping first-seen order. Each expected value below was copied from running it, not taken from a spec.
- Pin 1 covers stripping, lowercasing, a blank and a repeat in one input.
- Pin 2 uses `"b,A,a"`, where first-seen order differs from sorted order. With `"a,b"` the two orders match, so a switch to sorting could not turn it red.
- Pin 3 records an accident: `None.split` raises `AttributeError`. Nobody designed that, but a caller may catch it.
// Python
import pytest
from tags import parse_tags
def test_cleans_and_dedupes():
assert parse_tags(" a, ,A ") == ["a"]
def test_keeps_first_seen_order():
assert parse_tags("b,A,a") == ["b", "a"]
def test_none_raises_attribute_error():
with pytest.raises(AttributeError):
parse_tags(None)