mirror of
https://github.com/dotnet/skills.git
synced 2026-09-20 09:49:54 +08:00
8fb17964bc
* Improve test smell skill quality Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Use conventional empty class bodies Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 718f824b-6b86-4d7f-9428-2d7a8908e95b * Improve test smell calibration Align workspace discovery and false-positive decisions with the losing eval transcripts, correct contradictory fixtures, and make graders outcome-focused. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 718f824b-6b86-4d7f-9428-2d7a8908e95b * Make eval regexes multiline-safe Allow outcome evidence to match across line breaks in generated review output. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 718f824b-6b86-4d7f-9428-2d7a8908e95b * Make notification fixtures observable Record notification identifiers so post-wait assertions can fail, while preserving fixed sleeps as the intentional smell under evaluation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 718f824b-6b86-4d7f-9428-2d7a8908e95b * Strengthen test smell stop conditions Require workspace discovery, preserve formal skip and file classifications, prevent clean-suite false positives, and reduce lexical grader coupling. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 718f824b-6b86-4d7f-9428-2d7a8908e95b * Use conventional exception class body Keep the fixture compatible with compilers that do not accept semicolon-only class declarations. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 718f824b-6b86-4d7f-9428-2d7a8908e95b * Remove brittle eval gates Rely on outcome rubrics instead of narrow lexical matches and keep the Sensitive Equality fixture culture-stable. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 718f824b-6b86-4d7f-9428-2d7a8908e95b * Add JUnit eval exit check Fail fast on empty or failed trial output while dropping a redundant severity-word matcher. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 718f824b-6b86-4d7f-9428-2d7a8908e95b * Make remaining eval regexes multiline-safe Allow concise verdict and async-fix patterns to match wrapped model output across line breaks. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 718f824b-6b86-4d7f-9428-2d7a8908e95b * Preserve non-catalog validity findings Keep formal smell classification while separately reporting proven test-validity defects that do not belong to the taxonomy. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 718f824b-6b86-4d7f-9428-2d7a8908e95b --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 718f824b-6b86-4d7f-9428-2d7a8908e95b
34 lines
605 B
Python
34 lines
605 B
Python
import pytest
|
|
from unittest.mock import Mock
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
("prices", "expected"),
|
|
[
|
|
([2, 3], 5),
|
|
([4, 6], 10),
|
|
],
|
|
)
|
|
def test_total_for_known_prices(prices, expected):
|
|
assert sum(prices) == expected
|
|
|
|
|
|
def test_callback_receives_total():
|
|
callback = Mock()
|
|
|
|
callback(12)
|
|
|
|
callback.assert_called_once_with(12)
|
|
|
|
|
|
def test_invalid_price_raises():
|
|
with pytest.raises(ValueError, match="price"):
|
|
raise ValueError("price must be positive")
|
|
|
|
|
|
def test_all_skus_are_present():
|
|
skus = ["A", "B", "C"]
|
|
|
|
for sku in skus:
|
|
assert sku
|