Repository: joke2k/faker
Pull request #897 (2019-01-19 11:55:30)

Group by Gender (zh_CN)


Patch:
diff --git a/docs/communityproviders.rst b/docs/communityproviders.rst
index cd6cdfa5..4a2304aa 100644
--- a/docs/communityproviders.rst
+++ b/docs/communityproviders.rst
@@ -21,8 +21,11 @@ Here's a list of Providers written by the community:
 | Credit Score  | Fake credit score data   | `faker_credit_score`_            |
 |               | for testing purposes     |                                  |
 +---------------+--------------------------+----------------------------------+
+| Microservice  | Fake microservice names  | `faker_microservice`_            |
++---------------+--------------------------+----------------------------------+
 
 .. _faker_web: https://pypi.org/project/faker_web/
 .. _faker_cloud: https://pypi.org/project/faker-cloud/
 .. _faker_wifi_essid: https://pypi.org/project/faker-wifi-essid/
 .. _faker_credit_score: https://pypi.org/project/faker-credit-score/
+.. _faker_microservice: https://pypi.org/project/faker-microservice/
diff --git a/faker/providers/person/zh_CN/__init__.py b/faker/providers/person/zh_CN/__init__.py
index 8f6b324c..a31c3c72 100644
--- a/faker/providers/person/zh_CN/__init__.py
+++ b/faker/providers/person/zh_CN/__init__.py
@@ -6,18 +6,25 @@ from .. import Provider as PersonProvider
 
 class Provider(PersonProvider):
     formats = ["{{last_name}}{{first_name}}"]
-    first_names = [
-        "伟", "芳", "娜", "敏", "静", "秀英", "丽", "强", "磊", "洋", "艳", "勇", "军", "杰", "娟",
-        "涛", "超", "明", "霞", "秀兰", "刚", "平", "燕", "辉", "玲", "桂英", "丹", "萍", "鹏", "华",
-        "红", "玉兰", "飞", "桂兰", "英", "梅", "鑫", "波", "斌", "莉", "宇", "浩", "凯", "秀珍", "健",
-        "俊", "帆", "雪", "帅", "慧", "旭", "宁", "婷", "玉梅", "龙", "林", "玉珍", "凤英", "晶", "欢",
-        "玉英", "颖", "红梅", "佳", "倩", "阳", "建华", "亮", "成", "琴", "兰英", "畅", "建", "云", "洁",
-        "峰", "建国", "建军", "柳", "淑珍", "春梅", "海燕", "晨", "冬梅", "秀荣", "瑞", "桂珍", "莹", "秀云",
-        "桂荣", "志强", "秀梅", "丽娟", "婷婷", "玉华", "兵", "雷", "东", "琳", "雪梅", "淑兰", "丽丽", "玉",
-        "秀芳", "欣", "淑英", "桂芳", "博", "丽华", "丹丹", "彬", "桂香", "坤", "想", "淑华", "荣", "秀华",
-        "桂芝", "岩", "杨", "小红", "金凤", "文", "利", "楠", "红霞", "建平", "瑜", "桂花", "璐", "凤兰",
+
+    first_names_male = [
+        "伟", "强", "磊", "洋", "勇", "军", "杰", "涛", "超", "明", "刚", "平", "辉", "鹏", "华", "飞",
+        "鑫", "波", "斌", "宇", "浩", "凯", "健", "俊", "帆", "帅",  "旭", "宁", "龙", "林", "欢", "佳",
+        "阳", "建华", "亮", "成", "建", "峰", "建国", "建军", "晨", "瑞", "志强", "兵", "雷", "东", "博",
+        "彬", "坤", "想", "岩", "杨",  "文", "利", "楠", "红霞", "建平",
+    ]
+
+    first_names_female = [
+        "芳", "娜", "敏", "静", "秀英", "丽", "艳", "娟", "霞", "秀兰", "燕", "玲", "桂英", "丹", "萍",
+        "红", "玉兰", "桂兰", "英", "梅", "莉", "秀珍", "婷", "玉梅", "玉珍", "凤英", "晶", "玉英", "颖",
+        "雪", "慧", "红梅", "倩", "琴", "兰英", "畅", "云", "洁", "柳", "淑珍", "春梅", "海燕", "冬梅",
+        "秀荣", "桂珍", "莹", "秀云", "桂荣", "秀梅", "丽娟", "婷婷", "玉华", "琳", "雪梅", "淑兰", "丽丽",
+        "玉", "秀芳", "欣", "淑英", "桂芳", "丽华", "丹丹", "桂香", "淑华", "荣", "秀华", "桂芝", "小红",
+        "金凤", "瑜", "桂花", "璐", "凤兰",
     ]
 
+    first_names = first_names_male + first_names_female
+
     # From https://zh.wikipedia.org/wiki/%E4%B8%AD%E5%9B%BD%E5%A7%93%E6%B0%8F%E6%8E%92%E5%90%8D
     last_names = OrderedDict((
         ('王', 7.170),


Test patch:
diff --git a/tests/providers/test_person.py b/tests/providers/test_person.py
index a8c99e85..4b642712 100644
--- a/tests/providers/test_person.py
+++ b/tests/providers/test_person.py
@@ -301,12 +301,14 @@ class TestZhCN(unittest.TestCase):
         assert name
         self.assertIsInstance(name, six.string_types)
         assert name in ZhCNProvider.first_names
+        assert name in ZhCNProvider.first_names_female
 
         # Male first name
         name = self.factory.first_name_male()
         assert name
         self.assertIsInstance(name, six.string_types)
         assert name in ZhCNProvider.first_names
+        assert name in ZhCNProvider.first_names_male
 
         # General first romanized name
         name = self.factory.first_romanized_name()