|
1 | | -"""Tests for validators.country (country_code, calling_code, and currency) using ISP, Logic Coverage, and boundary/branch checks.""" |
| 1 | +"""Tests for validators.country (country_code, calling_code, and currency) |
| 2 | +using ISP, Logic Coverage, and boundary/branch checks.""" |
2 | 3 |
|
3 | 4 | import re |
4 | 5 |
|
|
14 | 15 | country_code, |
15 | 16 | currency, |
16 | 17 | ) |
17 | | - |
18 | 18 | from validators.utils import ValidationError |
19 | 19 |
|
20 | 20 | _BYTES_AUTO_DETECT_XFAIL = pytest.mark.xfail( |
@@ -1121,6 +1121,7 @@ def test_currency_invalid_type_with_skip_symbols_false() -> None: |
1121 | 1121 | ) |
1122 | 1122 |
|
1123 | 1123 | def test_calling_code_valid_boundaries(value: str) -> None: |
| 1124 | + """Test calling_code with valid boundary values from _calling_codes.""" |
1124 | 1125 | assert calling_code(value) is True |
1125 | 1126 |
|
1126 | 1127 |
|
@@ -1163,6 +1164,7 @@ def test_calling_code_valid_boundaries(value: str) -> None: |
1163 | 1164 | ) |
1164 | 1165 |
|
1165 | 1166 | def test_calling_code_invalid_formatting(value: str) -> None: |
| 1167 | + """Test calling_code with invalid formatting edge cases.""" |
1166 | 1168 | _assert_result(calling_code(value), False) |
1167 | 1169 |
|
1168 | 1170 |
|
@@ -1245,6 +1247,7 @@ def test_country_code_defaults_are_auto_and_case_sensitive() -> None: |
1245 | 1247 | def test_country_code_valid_boundaries_and_case( |
1246 | 1248 | value: str, iso_format: str, ignore_case: bool |
1247 | 1249 | ) -> None: |
| 1250 | + """Test country_code with valid boundary values from _alpha2, _alpha3, and _numeric.""" |
1248 | 1251 | assert country_code(value, iso_format=iso_format, ignore_case=ignore_case) is True |
1249 | 1252 |
|
1250 | 1253 |
|
@@ -1359,6 +1362,7 @@ def test_country_code_valid_boundaries_and_case( |
1359 | 1362 | def test_country_code_invalid_cross_format_and_edge_cases( |
1360 | 1363 | value: str, iso_format: str, ignore_case: bool |
1361 | 1364 | ) -> None: |
| 1365 | + """Test country_code with invalid cross-format and edge cases.""" |
1362 | 1366 | _assert_result( |
1363 | 1367 | country_code(value, iso_format=iso_format, ignore_case=ignore_case), |
1364 | 1368 | False, |
@@ -1436,6 +1440,7 @@ def test_currency_defaults_skip_symbols_and_case_sensitive() -> None: |
1436 | 1440 | def test_currency_valid_boundaries_and_symbols( |
1437 | 1441 | value: str, skip_symbols: bool, ignore_case: bool |
1438 | 1442 | ) -> None: |
| 1443 | + """Test currency with valid boundary values from _currency_iso4217 and _currency_symbols.""" |
1439 | 1444 | assert currency(value, skip_symbols=skip_symbols, ignore_case=ignore_case) is True |
1440 | 1445 |
|
1441 | 1446 |
|
@@ -1495,6 +1500,7 @@ def test_currency_valid_boundaries_and_symbols( |
1495 | 1500 | def test_currency_invalid_edge_cases( |
1496 | 1501 | value: str, skip_symbols: bool, ignore_case: bool |
1497 | 1502 | ) -> None: |
| 1503 | + """Test currency with invalid edge cases.""" |
1498 | 1504 | _assert_result( |
1499 | 1505 | currency(value, skip_symbols=skip_symbols, ignore_case=ignore_case), |
1500 | 1506 | False, |
|
0 commit comments