Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions test_team_z.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,35 @@ def test_sg_nric_fin(self):

def test_sg_uen(self):
"""Test SG_UEN functionality"""
# Combine SG_EUN
valid_samples = ["53125226D"]

# Create invalid samples for negative testing
invalid_samples = [
"1234567X", # Too short
"2023123456Z", # Too long
"A23LP1234K", # Invalid prefix (must be T, S, or R)
"123456789" # Missing check letter
]

#result = []
result = analyze_text("53125226D",["SG_UEN"])
#result = result + analyze_text(" 123456789X ", ["SG_UEN"])
self.assertTrue(result, "Valid UEN not found:")

#Test both lists
for uen in (valid_samples + invalid_samples):
result = analyze_text(f"The entity UEN is {uen}", ["SG_UEN"])

if uen in invalid_samples:
# (Team) Negative test case: Expecting no result
self.assertFalse(result, f"Invalid UEN incorrectly detected: {uen}")
else:
# (Team) Positive test case: Expecting detection
self.assertTrue(result, f"Valid UEN not found: {uen}")
self.assertEqual(result[0].entity_type, 'SG_UEN')
self.assertAlmostEqual(result[0].score, 1.0, 2)



if __name__ == '__main__':
Expand Down