Repository: joke2k/faker
Pull request #1876 (2023-06-15 18:33:52)

Update providers/phone_number/uk_UA/__init__.py
https://countrycode.org/ukraine

https://uk.wikipedia.org/wiki/%D0%A2%D0%B5%D0%BB%D0%B5%D1%84%D0%BE%D0%BD%D0%BD%D0%B8%D0%B9_%D0%BD%D0%BE%D0%BC%D0%B5%D1%80

Ukraine Country Code +380

### What does this change

Replaced the country code with the real value for this locale.

### What was wrong

The country code used is +38, which is not currently assigned to any country.

### How this fixes it

Replace the +38 code with +380.

Fixes #...

The +38 code has been replaced by +380.



Patch:
diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index e3093761..863016fa 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 18.10.1
+current_version = 18.11.0
 files = VERSION faker/__init__.py docs/conf.py
 commit = True
 tag = True
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 44a0f28d..d106370f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 ## Changelog
 
+### [v18.11.0 - 2023-06-20](https://github.com/joke2k/faker/compare/v18.10.1...v18.11.0)
+
+* Add digit-above-two type to numerify function. Thanks @dlwrnc.
+
 ### [v18.10.1 - 2023-06-02](https://github.com/joke2k/faker/compare/v18.10.0...v18.10.1)
 
 * Fix handling leap year in `en_US` Passport provider. Thanks @mgorny.
diff --git a/VERSION b/VERSION
index 046b2c6d..9b7b3ce8 100644
--- a/VERSION
+++ b/VERSION
@@ -1,1 +1,1 @@
-18.10.1
+18.11.0
diff --git a/docs/conf.py b/docs/conf.py
index 61086628..e15962a7 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -51,9 +51,9 @@ copyright = "2014, Daniele Faraglia"
 # built documents.
 #
 # The short X.Y version.
-version = "18.10.1"
+version = "18.11.0"
 # The full version, including alpha/beta/rc tags.
-release = "18.10.1"
+release = "18.11.0"
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/faker/__init__.py b/faker/__init__.py
index 5daf7d20..c8b96535 100644
--- a/faker/__init__.py
+++ b/faker/__init__.py
@@ -2,6 +2,6 @@ from faker.factory import Factory
 from faker.generator import Generator
 from faker.proxy import Faker
 
-VERSION = "18.10.1"
+VERSION = "18.11.0"
 
 __all__ = ("Factory", "Generator", "Faker")
diff --git a/faker/providers/__init__.py b/faker/providers/__init__.py
index c329d512..e4932a4d 100644
--- a/faker/providers/__init__.py
+++ b/faker/providers/__init__.py
@@ -10,6 +10,7 @@ from ..utils.distribution import choices_distribution, choices_distribution_uniq
 
 _re_hash = re.compile(r"#")
 _re_perc = re.compile(r"%")
+_re_dol = re.compile(r"\$")
 _re_excl = re.compile(r"!")
 _re_at = re.compile(r"@")
 _re_qm = re.compile(r"\?")
@@ -325,6 +326,11 @@ class BaseProvider:
 
         return self.generator.random.randint(1, 9)
 
+    def random_digit_above_two(self) -> int:
+        """Generate a random digit above value two (2 to 9)."""
+
+        return self.generator.random.randint(2, 9)
+
     def random_digit_or_empty(self) -> Union[int, str]:
         """Generate a random digit (0 to 9) or an empty string.
 
@@ -603,6 +609,7 @@ class BaseProvider:
 
         - Number signs ('#') are replaced with a random digit (0 to 9).
         - Percent signs ('%') are replaced with a random non-zero digit (1 to 9).
+        - Dollar signs ('$') are replaced with a random digit above two (2 to 9).
         - Exclamation marks ('!') are replaced with a random digit or an empty string.
         - At symbols ('@') are replaced with a random non-zero digit or an empty string.
 
@@ -617,6 +624,7 @@ class BaseProvider:
         """
         text = _re_hash.sub(lambda x: str(self.random_digit()), text)
         text = _re_perc.sub(lambda x: str(self.random_digit_not_null()), text)
+        text = _re_dol.sub(lambda x: str(self.random_digit_above_two()), text)
         text = _re_excl.sub(lambda x: str(self.random_digit_or_empty()), text)
         text = _re_at.sub(lambda x: str(self.random_digit_not_null_or_empty()), text)
         return text
diff --git a/faker/providers/phone_number/en_US/__init__.py b/faker/providers/phone_number/en_US/__init__.py
index ac1367e8..dc7dc7ee 100644
--- a/faker/providers/phone_number/en_US/__init__.py
+++ b/faker/providers/phone_number/en_US/__init__.py
@@ -4,45 +4,45 @@ from .. import Provider as PhoneNumberProvider
 class Provider(PhoneNumberProvider):
     formats = (
         # Standard 10-digit phone number formats
-        "##########",
-        "##########",
-        "###-###-####",
-        "###-###-####",
+        "$##$######",
+        "$##$######",
+        "$##-$##-####",
+        "$##-$##-####",
         # Optional 10-digit local phone number format
-        "(###)###-####",
-        "(###)###-####",
+        "($##)$##-####",
+        "($##)$##-####",
         # Non-standard 10-digit phone number format
-        "###.###.####",
-        "###.###.####",
+        "$##.$##.####",
+        "$##.$##.####",
         # Standard 10-digit phone number format with extensions
-        "###-###-####x###",
-        "###-###-####x####",
-        "###-###-####x#####",
+        "$##-$##-####x###",
+        "$##-$##-####x####",
+        "$##-$##-####x#####",
         # Optional 10-digit local phone number format with extensions
-        "(###)###-####x###",
-        "(###)###-####x####",
-        "(###)###-####x#####",
+        "($##)$##-####x###",
+        "($##)$##-####x####",
+        "($##)$##-####x#####",
         # Non-standard 10-digit phone number format with extensions
-        "###.###.####x###",
-        "###.###.####x####",
-        "###.###.####x#####",
+        "$##.$##.####x###",
+        "$##.$##.####x####",
+        "$##.$##.####x#####",
         # Standard 11-digit phone number format
-        "+1-###-###-####",
-        "001-###-###-####",
+        "+1-$##-$##-####",
+        "001-$##-$##-####",
         # Standard 11-digit phone number format with extensions
-        "+1-###-###-####x###",
-        "+1-###-###-####x####",
-        "+1-###-###-####x#####",
-        "001-###-###-####x###",
-        "001-###-###-####x####",
-        "001-###-###-####x#####",
+        "+1-$##-$##-####x###",
+        "+1-$##-$##-####x####",
+        "+1-$##-$##-####x#####",
+        "001-$##-$##-####x###",
+        "001-$##-$##-####x####",
+        "001-$##-$##-####x#####",
     )
 
     basic_formats = (
         # basic 10-digit phone number format with no extensions
-        "##########",
-        "###-###-####",
-        "(###)###-####",
+        "$##$######",
+        "$##-$##-####",
+        "($##)$##-####",
     )
 
     def basic_phone_number(self) -> str:
diff --git a/faker/providers/phone_number/uk_UA/__init__.py b/faker/providers/phone_number/uk_UA/__init__.py
index 1da25ee4..d26d3365 100644
--- a/faker/providers/phone_number/uk_UA/__init__.py
+++ b/faker/providers/phone_number/uk_UA/__init__.py
@@ -7,8 +7,8 @@ class Provider(PhoneNumberProvider):
         "### ## ##",
         "0## ### ## ##",
         "0## ###-##-##",
-        "+38 0## ###-##-##",
-        "+38 0## ###-##-##",
-        "+38 (0##) ###-##-##",
-        "+38 0## ### ## ##",
+        "+380 ## ###-##-##",
+        "+380 ## ###-##-##",
+        "+380 (##) ###-##-##",
+        "+380 ## ### ## ##",
     )


Test patch:
diff --git a/tests/providers/__init__.py b/tests/providers/__init__.py
index 565a726c..efc9dec6 100644
--- a/tests/providers/__init__.py
+++ b/tests/providers/__init__.py
@@ -35,6 +35,10 @@ class TestBaseProvider:
         samples = [faker.random_digit_not_null() for _ in range(num_samples * 10)]
         assert set(samples) == set(range(1, 10))
 
+    def test_random_digit_above_two(self, faker, num_samples):
+        samples = [faker.random_digit_above_two() for _ in range(num_samples * 10)]
+        assert set(samples) == set(range(2, 10))
+
     def test_random_digit_or_empty(self, faker, num_samples):
         expected = set(range(10))
         expected.add("")
diff --git a/tests/providers/test_address.py b/tests/providers/test_address.py
index 0ecef674..35be9a81 100644
--- a/tests/providers/test_address.py
+++ b/tests/providers/test_address.py
@@ -872,7 +872,7 @@ class TestFrFr:
             assert isinstance(postcode, str)
             assert len(postcode) == 5
             assert (
-                postcode[:3] in department_numbers  # for 3 digits deparments number
+                postcode[:3] in department_numbers  # for 3 digits departments number
                 or postcode[:2] == "20"  # for Corsica : "2A" or "2B"
                 or postcode[:2] in department_numbers  # any other
             )