Skip to content

Commit 706af58

Browse files
thompsonsonclaude
andcommitted
fix: resolve formatting inconsistencies between make format and pre-commit
- Update ruff version in pre-commit-config.yaml to v0.11.13 to match local ruff - Fix version mismatch that caused disagreement between make format and pre-commit - Standardize assert formatting throughout test_architectural_constraints.py - Both commands now run without making any formatting changes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 69ed576 commit 706af58

File tree

2 files changed

+54
-52
lines changed

2 files changed

+54
-52
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
- id: debug-statements
1111

1212
- repo: https://github.com/astral-sh/ruff-pre-commit
13-
rev: v0.1.9
13+
rev: v0.11.13
1414
hooks:
1515
- id: ruff
1616
args: [--fix, --exit-non-zero-on-fix]

tests/test_architectural_constraints.py

Lines changed: 53 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,31 @@ def test_belief_update_dataclass_structure(self):
2525
fields = BeliefUpdate.__dataclass_fields__
2626

2727
# Should only contain comparison_result
28-
assert (
29-
len(fields) == 1
30-
), f"BeliefUpdate should have exactly 1 field, got {len(fields)}: {list(fields.keys())}"
31-
assert (
32-
"comparison_result" in fields
33-
), "BeliefUpdate must contain comparison_result field"
34-
assert (
35-
"dice_roll" not in fields
36-
), "BeliefUpdate MUST NOT contain dice_roll field"
28+
assert len(fields) == 1, (
29+
f"BeliefUpdate should have exactly 1 field, got {len(fields)}: "
30+
f"{list(fields.keys())}"
31+
)
32+
assert "comparison_result" in fields, (
33+
"BeliefUpdate must contain comparison_result field"
34+
)
35+
assert "dice_roll" not in fields, (
36+
"BeliefUpdate MUST NOT contain dice_roll field"
37+
)
3738

3839
def test_environment_evidence_dataclass_structure(self):
3940
"""Test that EnvironmentEvidence contains both dice_roll and comparison_result."""
4041
# Get all fields of EnvironmentEvidence
4142
fields = EnvironmentEvidence.__dataclass_fields__
4243

4344
# Should contain both fields
44-
assert (
45-
len(fields) == 2
46-
), f"EnvironmentEvidence should have exactly 2 fields, got {len(fields)}: {list(fields.keys())}"
45+
assert len(fields) == 2, (
46+
f"EnvironmentEvidence should have exactly 2 fields, got {len(fields)}: "
47+
f"{list(fields.keys())}"
48+
)
4749
assert "dice_roll" in fields, "EnvironmentEvidence must contain dice_roll field"
48-
assert (
49-
"comparison_result" in fields
50-
), "EnvironmentEvidence must contain comparison_result field"
50+
assert "comparison_result" in fields, (
51+
"EnvironmentEvidence must contain comparison_result field"
52+
)
5153

5254
def test_belief_state_methods_no_dice_roll_parameters(self):
5355
"""Test that BayesianBeliefState methods don't accept dice_roll parameters."""
@@ -61,9 +63,9 @@ def test_belief_state_methods_no_dice_roll_parameters(self):
6163
signature = inspect.signature(method)
6264
param_names = list(signature.parameters.keys())
6365

64-
assert (
65-
"dice_roll" not in param_names
66-
), f"Method {method_name} MUST NOT have dice_roll parameter"
66+
assert "dice_roll" not in param_names, (
67+
f"Method {method_name} MUST NOT have dice_roll parameter"
68+
)
6769

6870
def test_belief_update_creation_without_dice_roll(self):
6971
"""Test that BeliefUpdate can be created without dice_roll."""
@@ -98,12 +100,12 @@ def test_information_filtering_in_coordination(self):
98100

99101
# Verify that evidence history in belief domain contains only comparison results
100102
for evidence in game.belief_state.evidence_history:
101-
assert hasattr(
102-
evidence, "comparison_result"
103-
), "Belief evidence must have comparison_result"
104-
assert not hasattr(
105-
evidence, "dice_roll"
106-
), "Belief evidence MUST NOT have dice_roll"
103+
assert hasattr(evidence, "comparison_result"), (
104+
"Belief evidence must have comparison_result"
105+
)
106+
assert not hasattr(evidence, "dice_roll"), (
107+
"Belief evidence MUST NOT have dice_roll"
108+
)
107109

108110
def test_domain_import_isolation(self):
109111
"""Test that belief domain doesn't import environment domain."""
@@ -113,12 +115,12 @@ def test_domain_import_isolation(self):
113115
belief_source = inspect.getsource(belief_module)
114116

115117
# Should not import environment domain
116-
assert (
117-
"from domains.environment" not in belief_source
118-
), "Belief domain MUST NOT import environment domain"
119-
assert (
120-
"import domains.environment" not in belief_source
121-
), "Belief domain MUST NOT import environment domain"
118+
assert "from domains.environment" not in belief_source, (
119+
"Belief domain MUST NOT import environment domain"
120+
)
121+
assert "import domains.environment" not in belief_source, (
122+
"Belief domain MUST NOT import environment domain"
123+
)
122124

123125
def test_proper_bayesian_calculation_structure(self):
124126
"""Test that belief updates use probabilistic calculations."""
@@ -135,9 +137,9 @@ def test_proper_bayesian_calculation_structure(self):
135137
prob_6 = belief_state.get_belief_for_target(6)
136138

137139
assert prob_1 > prob_6, "Higher evidence should favor lower targets"
138-
assert (
139-
abs(prob_6 - 0.0) < 1e-10
140-
), "Target 6 should have zero probability after 'higher' evidence"
140+
assert abs(prob_6 - 0.0) < 1e-10, (
141+
"Target 6 should have zero probability after 'higher' evidence"
142+
)
141143

142144
def test_coordination_layer_responsibility(self):
143145
"""Test that coordination layer properly orchestrates without leaking information."""
@@ -148,21 +150,21 @@ def test_coordination_layer_responsibility(self):
148150
state = game.play_round()
149151

150152
# Game state should have full information (for display)
151-
assert hasattr(
152-
state.evidence_history[0], "dice_roll"
153-
), "Game state should maintain full evidence for display"
154-
assert hasattr(
155-
state.evidence_history[0], "comparison_result"
156-
), "Game state should maintain comparison results"
153+
assert hasattr(state.evidence_history[0], "dice_roll"), (
154+
"Game state should maintain full evidence for display"
155+
)
156+
assert hasattr(state.evidence_history[0], "comparison_result"), (
157+
"Game state should maintain comparison results"
158+
)
157159

158160
# But belief state should only have comparison results
159161
belief_evidence = game.belief_state.evidence_history[0]
160-
assert hasattr(
161-
belief_evidence, "comparison_result"
162-
), "Belief evidence must have comparison_result"
163-
assert not hasattr(
164-
belief_evidence, "dice_roll"
165-
), "Belief evidence MUST NOT have dice_roll"
162+
assert hasattr(belief_evidence, "comparison_result"), (
163+
"Belief evidence must have comparison_result"
164+
)
165+
assert not hasattr(belief_evidence, "dice_roll"), (
166+
"Belief evidence MUST NOT have dice_roll"
167+
)
166168

167169
def test_no_hard_coded_probabilities(self):
168170
"""Test that belief calculations are dynamic, not hard-coded."""
@@ -181,10 +183,10 @@ def test_no_hard_coded_probabilities(self):
181183

182184
# Target 1 should have highest probability for "higher" evidence
183185

184-
assert (
185-
prob_1 > prob_last
186-
), f"Target 1 should be more likely than target {dice_sides}"
187-
assert (
188-
abs(prob_last - 0.0) < 1e-10
189-
), f"Target {dice_sides} should have zero probability"
186+
assert prob_1 > prob_last, (
187+
f"Target 1 should be more likely than target {dice_sides}"
188+
)
189+
assert abs(prob_last - 0.0) < 1e-10, (
190+
f"Target {dice_sides} should have zero probability"
191+
)
190192
assert prob_1 > 0, "Target 1 should have non-zero probability"

0 commit comments

Comments
 (0)