Regression tests for the pulled fixes (f59ada9)
Build PCM package / build (push) Successful in 7s

- test_stitching_pad_mid_plane_close: solder-filled THT stitching pad
  mid-pour, adaptive vs uniform. Fails at 13.8% low on the pre-pinning
  adaptive path, passes at <0.1% with it.
- normalize_decimal / parse_frequency: decimal commas parse, thousands-
  separator patterns raise instead of silently scaling 1000x.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
janik
2026-07-17 13:29:39 +07:00
parent d9ca118e1b
commit 38f8cdf7be
2 changed files with 44 additions and 0 deletions
+26
View File
@@ -166,6 +166,32 @@ def test_part_currents_and_ac(monkeypatch):
assert ada.rs_ratios == ref.rs_ratios assert ada.rs_ratios == ref.rs_ratios
def test_stitching_pad_mid_plane_close(monkeypatch):
"""A solder-filled THT stitching pad mid-pour leaves no keep-fine
marker of its own (mouth not cut, thick_scale untouched, no copper
boundary nearby): without the barrel-attachment pinning its links
landed in a coarse equipotential leaf and the local spreading
resistance vanished - R read ~20% low on this exact case."""
sq = [(0, 0), (40, 0), (40, 40), (0, 40)]
def prob():
p = make_multilayer(
[[(sq, [])], [(sq, [])]],
rect1_mm=(0, 15, 2, 25), rect2_mm=(38, 15, 40, 25),
contact1="L0", contact2="L1",
vias_mm=[(20, 20)], gap_mm=1.6, drill_mm=1.0)
v = p.vias[0]
v.kind = "pad"
v.pad_nm = int(1.8 * NM)
v.solder_filled = True
return p
ref = _run(prob(), 0.15, adaptive=False, monkeypatch=monkeypatch)
ada = _run(prob(), 0.15, adaptive=True, monkeypatch=monkeypatch)
assert ada.n_free < 0.4 * ref.n_free # pour still coarsens
assert ada.R_ohm == pytest.approx(ref.R_ohm, rel=2e-3)
def test_auto_cell_size_finer_with_adaptive(monkeypatch): def test_auto_cell_size_finer_with_adaptive(monkeypatch):
"""The auto sizer affords a larger fine-cell budget (finer h) when """The auto sizer affords a larger fine-cell budget (finer h) when
the adaptive grid is on.""" the adaptive grid is on."""
+18
View File
@@ -64,6 +64,24 @@ def test_parse_frequency():
skin.parse_frequency("-5k") skin.parse_frequency("-5k")
def test_normalize_decimal():
"""European decimal commas parse; thousands-separator patterns are
rejected ('1,500' silently becoming 1.5 was a 1000x input error)."""
assert skin.normalize_decimal("1,5") == "1.5"
assert skin.normalize_decimal("0,25") == "0.25"
assert skin.normalize_decimal("1,5000") == "1.5000" # 4 digits: decimal
assert skin.normalize_decimal("2.5") == "2.5"
for bad in ("1,500", "1.500,5", "1,000,000", "12,345"):
with pytest.raises(ValueError, match="separator"):
skin.normalize_decimal(bad)
def test_parse_frequency_decimal_comma():
assert skin.parse_frequency("1,5k") == 1500.0
with pytest.raises(ValueError):
skin.parse_frequency("1,500") # ambiguous, not 1.5 Hz
def test_single_layer_ac_scales_exactly(): def test_single_layer_ac_scales_exactly():
"""Uniform conductance scaling leaves the field shape unchanged: """Uniform conductance scaling leaves the field shape unchanged:
R_AC = R_DC * factor to solver precision.""" R_AC = R_DC * factor to solver precision."""