thompsonson commited on
Commit
05d254d
·
1 Parent(s): 755e6e4

ci: fix formating in test

Browse files
tests/test_architectural_constraints.py CHANGED
@@ -25,15 +25,15 @@ class TestArchitecturalConstraints:
25
  fields = BeliefUpdate.__dataclass_fields__
26
 
27
  # Should only contain comparison_result
28
- assert len(fields) == 1, (
29
- f"BeliefUpdate should have exactly 1 field, got {len(fields)}: {list(fields.keys())}"
30
- )
31
- assert "comparison_result" in fields, (
32
- "BeliefUpdate must contain comparison_result field"
33
- )
34
- assert "dice_roll" not in fields, (
35
- "BeliefUpdate MUST NOT contain dice_roll field"
36
- )
37
 
38
  def test_environment_evidence_dataclass_structure(self):
39
  """Test that EnvironmentEvidence contains both dice_roll and comparison_result."""
@@ -41,13 +41,13 @@ class TestArchitecturalConstraints:
41
  fields = EnvironmentEvidence.__dataclass_fields__
42
 
43
  # Should contain both fields
44
- assert len(fields) == 2, (
45
- f"EnvironmentEvidence should have exactly 2 fields, got {len(fields)}: {list(fields.keys())}"
46
- )
47
  assert "dice_roll" in fields, "EnvironmentEvidence must contain dice_roll field"
48
- assert "comparison_result" in fields, (
49
- "EnvironmentEvidence must contain comparison_result field"
50
- )
51
 
52
  def test_belief_state_methods_no_dice_roll_parameters(self):
53
  """Test that BayesianBeliefState methods don't accept dice_roll parameters."""
@@ -61,9 +61,9 @@ class TestArchitecturalConstraints:
61
  signature = inspect.signature(method)
62
  param_names = list(signature.parameters.keys())
63
 
64
- assert "dice_roll" not in param_names, (
65
- f"Method {method_name} MUST NOT have dice_roll parameter"
66
- )
67
 
68
  def test_belief_update_creation_without_dice_roll(self):
69
  """Test that BeliefUpdate can be created without dice_roll."""
@@ -98,12 +98,12 @@ class TestArchitecturalConstraints:
98
 
99
  # Verify that evidence history in belief domain contains only comparison results
100
  for evidence in game.belief_state.evidence_history:
101
- assert hasattr(evidence, "comparison_result"), (
102
- "Belief evidence must have comparison_result"
103
- )
104
- assert not hasattr(evidence, "dice_roll"), (
105
- "Belief evidence MUST NOT have dice_roll"
106
- )
107
 
108
  def test_domain_import_isolation(self):
109
  """Test that belief domain doesn't import environment domain."""
@@ -113,12 +113,12 @@ class TestArchitecturalConstraints:
113
  belief_source = inspect.getsource(belief_module)
114
 
115
  # Should not import environment domain
116
- assert "from domains.environment" not in belief_source, (
117
- "Belief domain MUST NOT import environment domain"
118
- )
119
- assert "import domains.environment" not in belief_source, (
120
- "Belief domain MUST NOT import environment domain"
121
- )
122
 
123
  def test_proper_bayesian_calculation_structure(self):
124
  """Test that belief updates use probabilistic calculations."""
@@ -135,9 +135,9 @@ class TestArchitecturalConstraints:
135
  prob_6 = belief_state.get_belief_for_target(6)
136
 
137
  assert prob_1 > prob_6, "Higher evidence should favor lower targets"
138
- assert abs(prob_6 - 0.0) < 1e-10, (
139
- "Target 6 should have zero probability after 'higher' evidence"
140
- )
141
 
142
  def test_coordination_layer_responsibility(self):
143
  """Test that coordination layer properly orchestrates without leaking information."""
@@ -148,21 +148,21 @@ class TestArchitecturalConstraints:
148
  state = game.play_round()
149
 
150
  # Game state should have full information (for display)
151
- assert hasattr(state.evidence_history[0], "dice_roll"), (
152
- "Game state should maintain full evidence for display"
153
- )
154
- assert hasattr(state.evidence_history[0], "comparison_result"), (
155
- "Game state should maintain comparison results"
156
- )
157
 
158
  # But belief state should only have comparison results
159
  belief_evidence = game.belief_state.evidence_history[0]
160
- assert hasattr(belief_evidence, "comparison_result"), (
161
- "Belief evidence must have comparison_result"
162
- )
163
- assert not hasattr(belief_evidence, "dice_roll"), (
164
- "Belief evidence MUST NOT have dice_roll"
165
- )
166
 
167
  def test_no_hard_coded_probabilities(self):
168
  """Test that belief calculations are dynamic, not hard-coded."""
@@ -181,10 +181,10 @@ class TestArchitecturalConstraints:
181
 
182
  # Target 1 should have highest probability for "higher" evidence
183
 
184
- assert prob_1 > prob_last, (
185
- f"Target 1 should be more likely than target {dice_sides}"
186
- )
187
- assert abs(prob_last - 0.0) < 1e-10, (
188
- f"Target {dice_sides} should have zero probability"
189
- )
190
  assert prob_1 > 0, "Target 1 should have non-zero probability"
 
25
  fields = BeliefUpdate.__dataclass_fields__
26
 
27
  # 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"
37
 
38
  def test_environment_evidence_dataclass_structure(self):
39
  """Test that EnvironmentEvidence contains both dice_roll and comparison_result."""
 
41
  fields = EnvironmentEvidence.__dataclass_fields__
42
 
43
  # Should contain both fields
44
+ assert (
45
+ len(fields) == 2
46
+ ), f"EnvironmentEvidence should have exactly 2 fields, got {len(fields)}: {list(fields.keys())}"
47
  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"
51
 
52
  def test_belief_state_methods_no_dice_roll_parameters(self):
53
  """Test that BayesianBeliefState methods don't accept dice_roll parameters."""
 
61
  signature = inspect.signature(method)
62
  param_names = list(signature.parameters.keys())
63
 
64
+ assert (
65
+ "dice_roll" not in param_names
66
+ ), f"Method {method_name} MUST NOT have dice_roll parameter"
67
 
68
  def test_belief_update_creation_without_dice_roll(self):
69
  """Test that BeliefUpdate can be created without dice_roll."""
 
98
 
99
  # Verify that evidence history in belief domain contains only comparison results
100
  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"
107
 
108
  def test_domain_import_isolation(self):
109
  """Test that belief domain doesn't import environment domain."""
 
113
  belief_source = inspect.getsource(belief_module)
114
 
115
  # 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"
122
 
123
  def test_proper_bayesian_calculation_structure(self):
124
  """Test that belief updates use probabilistic calculations."""
 
135
  prob_6 = belief_state.get_belief_for_target(6)
136
 
137
  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"
141
 
142
  def test_coordination_layer_responsibility(self):
143
  """Test that coordination layer properly orchestrates without leaking information."""
 
148
  state = game.play_round()
149
 
150
  # 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"
157
 
158
  # But belief state should only have comparison results
159
  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"
166
 
167
  def test_no_hard_coded_probabilities(self):
168
  """Test that belief calculations are dynamic, not hard-coded."""
 
181
 
182
  # Target 1 should have highest probability for "higher" evidence
183
 
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"
190
  assert prob_1 > 0, "Target 1 should have non-zero probability"