@@ -167,7 +167,7 @@ def test_participant_with_cancer_only(db_session, test_user):
167167 "treatments" : ["Chemotherapy" , "Transfusions" ],
168168 "experiences" : ["Anxiety" , "Fatigue" ],
169169 },
170- "additional_info" : "I have specific dietary restrictions and prefer morning appointments." ,
170+ "additional_info" : " I have specific dietary restrictions and prefer morning appointments." ,
171171 }
172172
173173 # Act
@@ -198,7 +198,7 @@ def test_participant_with_cancer_only(db_session, test_user):
198198 assert user_data .caring_for_someone == "no"
199199
200200 # Assert - Additional Info
201- assert user_data .additional_info == " I have specific dietary restrictions and prefer morning appointments."
201+ assert user_data .additional_info == "I have specific dietary restrictions and prefer morning appointments."
202202
203203 # Assert - Treatments (many-to-many)
204204 treatment_names = [t .name for t in user_data .treatments ]
@@ -256,7 +256,7 @@ def test_volunteer_caregiver_experience_processing(db_session, test_user):
256256 "caregiver_experience" : {
257257 "experiences" : ["Anxiety" , "Depression" ],
258258 },
259- "additional_info" : "I have experience with elderly care and can provide emotional support." ,
259+ "additional_info" : "I have experience with elderly care and can provide emotional support. I have special requirements \n \t " ,
260260 "loved_one" : {
261261 "demographics" : {"gender_identity" : "Male" , "age" : "45-54" },
262262 "cancer_experience" : {
@@ -291,7 +291,7 @@ def test_volunteer_caregiver_experience_processing(db_session, test_user):
291291 assert "Depression" in experience_names
292292
293293 # Assert - Additional Info
294- assert user_data .additional_info == "I have experience with elderly care and can provide emotional support."
294+ assert user_data .additional_info == "I have experience with elderly care and can provide emotional support. I have special requirements "
295295
296296 # Assert - No personal cancer experience
297297 assert user_data .diagnosis is None
@@ -365,6 +365,7 @@ def test_form_submission_json_structure(db_session, test_user):
365365 "experiences" : ["Brain Fog" , "Feeling Overwhelmed" ],
366366 },
367367 },
368+ "additional_info" : "I'm only free on weekdays." ,
368369 }
369370
370371 # Act
@@ -388,6 +389,8 @@ def test_form_submission_json_structure(db_session, test_user):
388389 assert len (user_data .loved_one_treatments ) >= 2 # Radiation + Palliative
389390 assert len (user_data .loved_one_experiences ) >= 2 # Brain Fog + Feeling Overwhelmed
390391
392+ assert user_data .additional_info == "I'm only free on weekdays."
393+
391394 db_session .refresh (test_user )
392395 assert test_user .form_status == FormStatus .INTAKE_SUBMITTED
393396
@@ -423,6 +426,7 @@ def test_empty_and_minimal_data_handling(db_session, test_user):
423426 "marital_status" : "" , # Empty string
424427 "has_kids" : "" ,
425428 },
429+ "additional_info" : "" ,
426430 # No cancer_experience, caregiver_experience, or loved_one sections
427431 }
428432
@@ -447,6 +451,8 @@ def test_empty_and_minimal_data_handling(db_session, test_user):
447451 assert len (user_data .experiences ) == 0
448452 assert user_data .loved_one_gender_identity is None
449453
454+ assert user_data .additional_info == ""
455+
450456 db_session .refresh (test_user )
451457 assert test_user .form_status == FormStatus .INTAKE_SUBMITTED
452458
@@ -491,6 +497,7 @@ def test_participant_caregiver_without_cancer(db_session, test_user):
491497 "experiences" : ["Anxiety" , "Communication Challenges" ],
492498 },
493499 },
500+ "additional_info" : "I need to be in the same city as the loved one" ,
494501 }
495502
496503 # Act
@@ -528,6 +535,8 @@ def test_participant_caregiver_without_cancer(db_session, test_user):
528535 assert "Anxiety" in loved_one_experience_names
529536 assert "Communication Challenges" in loved_one_experience_names
530537
538+ assert user_data .additional_info == "I need to be in the same city as the loved one"
539+
531540 db_session .commit ()
532541
533542 except Exception :
@@ -612,6 +621,8 @@ def test_participant_cancer_patient_and_caregiver(db_session, test_user):
612621 # Assert - Custom demographics
613622 assert "Other" in user_data .ethnic_group
614623 assert user_data .other_ethnic_group == "Mixed European heritage"
624+
625+ assert user_data .additional_info is None
615626
616627 db_session .commit ()
617628
@@ -680,6 +691,8 @@ def test_participant_no_cancer_experience(db_session, test_user):
680691 assert len (user_data .loved_one_treatments ) == 0
681692 assert len (user_data .loved_one_experiences ) == 0
682693
694+ assert user_data .additional_info is None
695+
683696 db_session .commit ()
684697
685698 except Exception :
@@ -749,6 +762,8 @@ def test_volunteer_cancer_patient_only(db_session, test_user):
749762 assert len (user_data .loved_one_treatments ) == 0
750763 assert len (user_data .loved_one_experiences ) == 0
751764
765+ assert user_data .additional_info is None
766+
752767 db_session .commit ()
753768
754769 except Exception :
@@ -796,6 +811,7 @@ def test_volunteer_cancer_patient_and_caregiver(db_session, test_user):
796811 "experiences" : ["Brain Fog" , "Fatigue" ],
797812 },
798813 },
814+ "additional_info" : "N/A" ,
799815 }
800816
801817 # Act
@@ -826,6 +842,8 @@ def test_volunteer_cancer_patient_and_caregiver(db_session, test_user):
826842 assert len (user_data .loved_one_treatments ) >= 2
827843 assert len (user_data .loved_one_experiences ) >= 2
828844
845+ assert user_data .additional_info == "N/A"
846+
829847 db_session .commit ()
830848
831849 except Exception :
@@ -892,6 +910,8 @@ def test_volunteer_no_cancer_experience(db_session, test_user):
892910 assert len (user_data .loved_one_treatments ) == 0
893911 assert len (user_data .loved_one_experiences ) == 0
894912
913+ assert user_data .additional_info is None
914+
895915 db_session .commit ()
896916
897917 except Exception :
@@ -1187,6 +1207,7 @@ def test_unicode_and_special_characters(db_session, test_user):
11871207 "treatments" : ["Chimiothérapie" ],
11881208 "experiences" : ["Fatigue" ],
11891209 },
1210+ "additional_info" : "émojis 🎉, unicode 中文, and various symbols @#$%^&*()" ,
11901211 }
11911212
11921213 user_data = processor .process_form_submission (str (test_user .id ), form_data )
@@ -1200,6 +1221,8 @@ def test_unicode_and_special_characters(db_session, test_user):
12001221 assert "हिन्दी" in user_data .other_ethnic_group
12011222 assert "🌍" in user_data .other_ethnic_group
12021223
1224+ assert user_data .additional_info == "émojis 🎉, unicode 中文, and various symbols @#$%^&*()"
1225+
12031226 db_session .commit ()
12041227
12051228 except Exception :
@@ -1245,116 +1268,3 @@ def test_boundary_date_values(db_session, test_user):
12451268 except Exception :
12461269 db_session .rollback ()
12471270 raise
1248-
1249-
1250- # def test_additional_info_field_processing(db_session, test_user):
1251- # """Test processing of additional_info field with various scenarios"""
1252- # try:
1253- # processor = IntakeFormProcessor(db_session)
1254-
1255- # # Test 1: Normal additional info
1256- # form_data_with_info = {
1257- # "form_type": "participant",
1258- # "has_blood_cancer": "yes",
1259- # "caring_for_someone": "no",
1260- # "personal_info": {
1261- # "first_name": "Test",
1262- # "last_name": "User",
1263- # "date_of_birth": "01/01/1990",
1264- # "phone_number": "555-1234",
1265- # "city": "Toronto",
1266- # "province": "Ontario",
1267- # "postal_code": "M5V 3A1",
1268- # },
1269- # "additional_info": "I have specific dietary needs and prefer afternoon appointments.",
1270- # }
1271-
1272- # user_data = processor.process_form_submission(str(test_user.id), form_data_with_info)
1273- # assert user_data.additional_info == "I have specific dietary needs and prefer afternoon appointments."
1274-
1275- # # Test 2: Empty additional info
1276- # form_data_empty = {
1277- # "form_type": "participant",
1278- # "has_blood_cancer": "no",
1279- # "caring_for_someone": "no",
1280- # "personal_info": {
1281- # "first_name": "Test",
1282- # "last_name": "User2",
1283- # "date_of_birth": "01/01/1990",
1284- # "phone_number": "555-1234",
1285- # "city": "Toronto",
1286- # "province": "Ontario",
1287- # "postal_code": "M5V 3A1",
1288- # },
1289- # "additional_info": "",
1290- # }
1291-
1292- # user_data_empty = processor.process_form_submission(str(test_user.id), form_data_empty)
1293- # assert user_data_empty.additional_info == ""
1294-
1295- # # Test 3: Additional info with whitespace (should be trimmed)
1296- # form_data_whitespace = {
1297- # "form_type": "participant",
1298- # "has_blood_cancer": "no",
1299- # "caring_for_someone": "no",
1300- # "personal_info": {
1301- # "first_name": "Test",
1302- # "last_name": "User3",
1303- # "date_of_birth": "01/01/1990",
1304- # "phone_number": "555-1234",
1305- # "city": "Toronto",
1306- # "province": "Ontario",
1307- # "postal_code": "M5V 3A1",
1308- # },
1309- # "additional_info": " I have special requirements \n\t",
1310- # }
1311-
1312- # user_data_whitespace = processor.process_form_submission(str(test_user.id), form_data_whitespace)
1313- # assert user_data_whitespace.additional_info == "I have special requirements"
1314-
1315- # # Test 4: No additional_info field (should be None)
1316- # form_data_no_field = {
1317- # "form_type": "participant",
1318- # "has_blood_cancer": "no",
1319- # "caring_for_someone": "no",
1320- # "personal_info": {
1321- # "first_name": "Test",
1322- # "last_name": "User4",
1323- # "date_of_birth": "01/01/1990",
1324- # "phone_number": "555-1234",
1325- # "city": "Toronto",
1326- # "province": "Ontario",
1327- # "postal_code": "M5V 3A1",
1328- # },
1329- # # No additional_info field
1330- # }
1331-
1332- # user_data_no_field = processor.process_form_submission(str(test_user.id), form_data_no_field)
1333- # assert user_data_no_field.additional_info is None
1334-
1335- # # Test 5: Long additional info with special characters
1336- # long_text = "This is a very long additional information field that contains special characters: émojis 🎉, unicode 中文, and various symbols @#$%^&*(). It should be stored correctly without any issues."
1337- # form_data_long = {
1338- # "form_type": "participant",
1339- # "has_blood_cancer": "no",
1340- # "caring_for_someone": "no",
1341- # "personal_info": {
1342- # "first_name": "Test",
1343- # "last_name": "User5",
1344- # "date_of_birth": "01/01/1990",
1345- # "phone_number": "555-1234",
1346- # "city": "Toronto",
1347- # "province": "Ontario",
1348- # "postal_code": "M5V 3A1",
1349- # },
1350- # "additional_info": long_text,
1351- # }
1352-
1353- # user_data_long = processor.process_form_submission(str(test_user.id), form_data_long)
1354- # assert user_data_long.additional_info == long_text
1355-
1356- # db_session.commit()
1357-
1358- # except Exception:
1359- # db_session.rollback()
1360- # raise
0 commit comments