Repository: joke2k/faker

Issue:
Add method to generate a cell phone number to pt-BR
Faker doesn't have a function to generate a cellphone to Brazilian.

Steps to reproduce
Create fake instance using localization "pt_BR"
Call fake.msisdn() or fake.phone_number()
Expected behavior
It should generate a cell phone number.

Actual behavior
Sometimes these methods return a "residential" numbers.

Reference difference between cell phones and residential numbers:

http://www.teleco.com.br/num.asp

Discussion:

Patch:
diff --git a/faker/providers/phone_number/pt_BR/__init__.py b/faker/providers/phone_number/pt_BR/__init__.py
index 95707ba6..ca3efbd3 100644
--- a/faker/providers/phone_number/pt_BR/__init__.py
+++ b/faker/providers/phone_number/pt_BR/__init__.py
@@ -71,6 +71,7 @@ class Provider(PhoneNumberProvider):
         '#### ####',
         '####-####',
     )
+
     msisdn_formats = (
         '5511#########',
         '5521#########',
@@ -81,3 +82,11 @@ class Provider(PhoneNumberProvider):
         '5571#########',
         '5581#########',
     )
+
+    cellphone_formats = (
+        '+55 9#### ####',
+    )
+
+    def cellphone_number(self):
+        pattern = self.random_element(self.cellphone_formats)
+        return self.numerify(self.generator.parse(pattern))


Test patch:
diff --git a/tests/providers/test_phone_number.py b/tests/providers/test_phone_number.py
index 156082cb..572e80d7 100644
--- a/tests/providers/test_phone_number.py
+++ b/tests/providers/test_phone_number.py
@@ -64,6 +64,12 @@ class TestPhoneNumber(unittest.TestCase):
         assert msisdn.isdigit()
         assert msisdn[0:4] in formats
 
+    def test_cellphone_pt_br(self):
+        factory = Faker('pt_BR')
+        cellphone = factory.cellphone_number()
+        assert cellphone is not None
+        assert len(cellphone) == 14
+
 
 class TestHuHU(unittest.TestCase):