From 126d40ccc5c8252cfbcc94875b59555d5f0471d1 Mon Sep 17 00:00:00 2001 From: David Knox <141048171+dbknox@users.noreply.github.com> Date: Thu, 16 Oct 2025 20:00:48 +0000 Subject: [PATCH 1/4] Completed medical_license test case --- test_team_bit_by_bit.py | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/test_team_bit_by_bit.py b/test_team_bit_by_bit.py index 0629735..6f5eed0 100644 --- a/test_team_bit_by_bit.py +++ b/test_team_bit_by_bit.py @@ -21,9 +21,41 @@ def test_date_time(self): def test_email_address(self): """Test EMAIL_ADDRESS functionality""" - def test_medical_license(self): - """Test MEDICAL_LICENSE functionality""" - - +def test_medical_license(self): + """ + Test MEDICAL_LICENSE functionality. + Includes positive tests for numeric and alphanumeric formats, + and a negative test. + """ + # Define the entity type locally + ENTITY_TYPE = "MEDICAL_LICENSE" + + # --- POSITIVE TEST CASES (25% of grade) --- + + # 1. FIX: Use a highly recognizable CA medical license format (A12345) with context + text_1 = "CA Medical License A12345 is valid." + # FIX: Passing the entity list as the second positional argument + results_1 = analyze_text(text_1, [ENTITY_TYPE]) + self.assertGreater(len(results_1), 0, "Positive Test 1 failed: No medical license detected (CA format).") + self.assertTrue(any(r.entity_type == ENTITY_TYPE for r in results_1), + "Positive Test 1 failed: Wrong entity type detected.") + + # 2. FIX: Use a highly recognizable TX medical license format (123456789) with context + text_2 = "The doctor's TX state license is 123456789." + # FIX: Passing the entity list as the second positional argument + results_2 = analyze_text(text_2, [ENTITY_TYPE]) + self.assertGreater(len(results_2), 0, "Positive Test 2 failed: No medical license detected (TX format).") + self.assertTrue(any(r.entity_type == ENTITY_TYPE for r in results_2), + "Positive Test 2 failed: Wrong entity type detected.") + + # --- NEGATIVE TEST CASE (25% of grade) --- + + # 3. Test a short, non-license number + text_negative = "The office extension is 1001, please call quickly." + # FIX: Passing the entity list as the second positional argument + results_negative = analyze_text(text_negative, [ENTITY_TYPE]) + self.assertFalse(any(r.entity_type == ENTITY_TYPE for r in results_negative), + "Negative Test failed: A short number was incorrectly flagged as a MEDICAL_LICENSE.") + if __name__ == '__main__': unittest.main() From 3aef207dc9ee042a5bf588ff4ab4e19f263e8853 Mon Sep 17 00:00:00 2001 From: David Knox <141048171+dbknox@users.noreply.github.com> Date: Thu, 16 Oct 2025 20:24:33 +0000 Subject: [PATCH 2/4] medical license update --- test_team_bit_by_bit.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/test_team_bit_by_bit.py b/test_team_bit_by_bit.py index 6f5eed0..5cc0bb2 100644 --- a/test_team_bit_by_bit.py +++ b/test_team_bit_by_bit.py @@ -21,28 +21,23 @@ def test_date_time(self): def test_email_address(self): """Test EMAIL_ADDRESS functionality""" -def test_medical_license(self): +def test_medical_license(self): """ - Test MEDICAL_LICENSE functionality. - Includes positive tests for numeric and alphanumeric formats, - and a negative test. + Test MEDICAL_LICENSE functionality. (The final working version) """ - # Define the entity type locally ENTITY_TYPE = "MEDICAL_LICENSE" # --- POSITIVE TEST CASES (25% of grade) --- - # 1. FIX: Use a highly recognizable CA medical license format (A12345) with context + # 1. Use a highly recognizable CA medical license format (A12345) with specific context. text_1 = "CA Medical License A12345 is valid." - # FIX: Passing the entity list as the second positional argument results_1 = analyze_text(text_1, [ENTITY_TYPE]) self.assertGreater(len(results_1), 0, "Positive Test 1 failed: No medical license detected (CA format).") self.assertTrue(any(r.entity_type == ENTITY_TYPE for r in results_1), "Positive Test 1 failed: Wrong entity type detected.") - # 2. FIX: Use a highly recognizable TX medical license format (123456789) with context + # 2. Use a highly recognizable TX medical license format (123456789) with context. text_2 = "The doctor's TX state license is 123456789." - # FIX: Passing the entity list as the second positional argument results_2 = analyze_text(text_2, [ENTITY_TYPE]) self.assertGreater(len(results_2), 0, "Positive Test 2 failed: No medical license detected (TX format).") self.assertTrue(any(r.entity_type == ENTITY_TYPE for r in results_2), @@ -50,12 +45,10 @@ def test_medical_license(self): # --- NEGATIVE TEST CASE (25% of grade) --- - # 3. Test a short, non-license number + # 3. Test a short, non-license number that could be a false positive. text_negative = "The office extension is 1001, please call quickly." - # FIX: Passing the entity list as the second positional argument results_negative = analyze_text(text_negative, [ENTITY_TYPE]) self.assertFalse(any(r.entity_type == ENTITY_TYPE for r in results_negative), "Negative Test failed: A short number was incorrectly flagged as a MEDICAL_LICENSE.") - if __name__ == '__main__': unittest.main() From 79fbbc8733a954baab01f5e3e303c6e354b43817 Mon Sep 17 00:00:00 2001 From: claesmk <44329220+claesmk@users.noreply.github.com> Date: Fri, 17 Oct 2025 11:22:24 +0000 Subject: [PATCH 3/4] Added some valid sample license numbers --- test_team_bit_by_bit.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test_team_bit_by_bit.py b/test_team_bit_by_bit.py index 57e20ae..9768025 100644 --- a/test_team_bit_by_bit.py +++ b/test_team_bit_by_bit.py @@ -41,7 +41,7 @@ def test_date_time(self): def test_email_address(self): """Test EMAIL_ADDRESS functionality""" -def test_medical_license(self): + def test_medical_license(self): """ Test MEDICAL_LICENSE functionality. (The final working version) """ @@ -50,14 +50,14 @@ def test_medical_license(self): # --- POSITIVE TEST CASES (25% of grade) --- # 1. Use a highly recognizable CA medical license format (A12345) with specific context. - text_1 = "CA Medical License A12345 is valid." + text_1 = "CA Medical License H93456781 is valid." results_1 = analyze_text(text_1, [ENTITY_TYPE]) self.assertGreater(len(results_1), 0, "Positive Test 1 failed: No medical license detected (CA format).") self.assertTrue(any(r.entity_type == ENTITY_TYPE for r in results_1), "Positive Test 1 failed: Wrong entity type detected.") # 2. Use a highly recognizable TX medical license format (123456789) with context. - text_2 = "The doctor's TX state license is 123456789." + text_2 = "The doctor's TX state license is BB7989001." results_2 = analyze_text(text_2, [ENTITY_TYPE]) self.assertGreater(len(results_2), 0, "Positive Test 2 failed: No medical license detected (TX format).") self.assertTrue(any(r.entity_type == ENTITY_TYPE for r in results_2), @@ -69,6 +69,6 @@ def test_medical_license(self): text_negative = "The office extension is 1001, please call quickly." results_negative = analyze_text(text_negative, [ENTITY_TYPE]) self.assertFalse(any(r.entity_type == ENTITY_TYPE for r in results_negative), - "Negative Test failed: A short number was incorrectly flagged as a MEDICAL_LICENSE.") + "Negative Test failed: A short number was incorrectly flagged as a MEDICAL_LICENSE.") if __name__ == '__main__': unittest.main() From c95cc5b7d2c83845cac269aba752236ddddeb685 Mon Sep 17 00:00:00 2001 From: claesmk <44329220+claesmk@users.noreply.github.com> Date: Fri, 17 Oct 2025 11:29:20 +0000 Subject: [PATCH 4/4] Removed trailing spaces --- test_team_bit_by_bit.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test_team_bit_by_bit.py b/test_team_bit_by_bit.py index 9768025..c740a5c 100644 --- a/test_team_bit_by_bit.py +++ b/test_team_bit_by_bit.py @@ -69,6 +69,8 @@ def test_medical_license(self): text_negative = "The office extension is 1001, please call quickly." results_negative = analyze_text(text_negative, [ENTITY_TYPE]) self.assertFalse(any(r.entity_type == ENTITY_TYPE for r in results_negative), - "Negative Test failed: A short number was incorrectly flagged as a MEDICAL_LICENSE.") + "Negative Test failed: A short number was incorrectly flagged as a MEDICAL_LICENSE.") + + if __name__ == '__main__': unittest.main()