Skip to content

Commit 8df8aed

Browse files
committed
[FIX] create test_10 field with correct type from start to avoid type change
1 parent 93286a7 commit 8df8aed

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

spp_custom_fields_ui/CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
## 2025-11-20
44

5-
### 2025-11-20 15:30:00 - [FIX] remove ttype change from test_10_onchange_field_category
5+
### 2025-11-20 15:45:00 - [FIX] create test_10 field with correct type from start to avoid type change
66

7-
- Removed field.ttype = "integer" line that was causing type change errors
8-
- Simplified assertion to verify field_category is set
9-
- Focuses on codecov coverage without triggering type change errors
7+
- Changed test_10 to create field with ttype="integer" and field_category="ind" from start
8+
- Updated field name to x_ind_grp_test_category to match indicator type
9+
- Follows same pattern as test_11 to avoid type change errors
10+
- Proper assertion now verifies compute field is set correctly
1011

1112
### 2025-11-20 15:15:00 - [FIX] remove test_13_onchange_has_presence and add coverage call to test_12
1213

spp_custom_fields_ui/tests/test_custom_fields_ui.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,23 +201,20 @@ def test_10_onchange_field_category(self):
201201
"""Test _onchange_field_category updates compute field"""
202202
field = self.field_model.create(
203203
{
204-
"name": "x_cst_grp_test_category",
204+
"name": "x_ind_grp_test_category",
205205
"model_id": self.model_id.id,
206206
"field_description": "Test Category Change",
207-
"ttype": "char",
207+
"ttype": "integer",
208208
"state": "manual",
209209
"target_type": "grp",
210-
"field_category": "cst",
210+
"field_category": "ind",
211211
}
212212
)
213-
self.assertFalse(field.compute)
214213

215-
# Change to indicator category and call onchange
216-
field.field_category = "ind"
214+
# Call onchange to ensure it executes set_compute
217215
field._onchange_field_category()
218216

219-
# Verify the method was called (may not set compute due to type mismatch, but ok for coverage)
220-
self.assertIsNotNone(field.field_category)
217+
self.assertTrue(field.compute, "Compute field should be set when field_category is indicator")
221218

222219
def test_11_onchange_kinds(self):
223220
"""Test _onchange_kinds updates compute field"""

0 commit comments

Comments
 (0)