@@ -38,29 +38,29 @@ def is_match(s: str):
38
38
("e10" , False ), # No digits before exponent (invalid)
39
39
40
40
# 4. Edge Cases
41
- ("" , False ), # Empty string
42
- (" " , False ), # Whitespace-only
43
- (" 42 " , False ), # Spaces around number
41
+ ("" , False ), # Empty string (invalid)
42
+ (" " , False ), # Whitespace-only (invalid)
43
+ (" 42 " , False ), # Spaces around number (invalid)
44
44
("+" , False ), # Only sign (invalid)
45
45
("-" , False ), # Only sign (invalid)
46
46
("++42" , False ), # Multiple signs (invalid)
47
47
("--42" , False ), # Multiple signs (invalid)
48
- ("42abc" , False ), # Invalid characters in the number
48
+ ("42abc" , False ), # Invalid characters in the number (invalid)
49
49
50
50
# 5. Invalid Formats
51
- ("42.5.1" , False ), # Multiple decimal separators
52
- ("." , False ), # Only decimal separator
51
+ ("42.5.1" , False ), # Multiple decimal separators (invalid)
52
+ ("." , False ), # Only decimal separator (invalid)
53
53
("1e" , False ), # Only scientific notation sign (invalid)
54
- ("1e " , False ), # Scientific notation without exponent
54
+ ("e " , False ), # Scientific notation without exponent (invalid)
55
55
56
56
# 6. Numbers with Commas (International)
57
57
("1,000" , True ), # Number with commas as thousands separators
58
58
("1,000.5" , False ), # Mixed usage of commas and dots (invalid)
59
59
60
60
# 7. Leading and Trailing Spaces
61
- (" 42" , False ), # Leading space
61
+ (" 42" , False ), # Leading space (invalid)
62
62
("42 " , True ), # Trailing space
63
- (" 42.5 " , False ), # Leading and trailing spaces
63
+ (" 42.5 " , False ), # Leading and trailing spaces (invalid)
64
64
])
65
65
66
66
def test_regex_match (test_input , expected ):
0 commit comments