How to use _last_names method in hypothesis

Best Python code snippet using hypothesis

namecreater.py

Source: namecreater.py Github

copy

Full Screen

1from random import choice as _choice2from datetime import datetime3_last_names = ['赵', '钱', '孙', '李', '周', '吴', '郑', '王', '冯', '陈', '褚', '卫', '蒋', '沈', '韩', '杨', '朱', '秦', '尤', '许',4 '何', '吕', '施', '张', '孔', '曹', '严', '华', '金', '魏', '陶', '姜', '戚', '谢', '邹', '喻', '柏', '水', '窦', '章',5 '云', '苏', '潘', '葛', '奚', '范', '彭', '郎', '鲁', '韦', '昌', '马', '苗', '凤', '花', '方', '俞', '任', '袁', '柳',6 '酆', '鲍', '史', '唐', '费', '廉', '岑', '薛', '雷', '贺', '倪', '汤', '滕', '殷', '罗', '毕', '郝', '邬', '安', '常',7 '乐', '于', '时', '傅', '皮', '卞', '齐', '康', '伍', '余', '元', '卜', '顾', '孟', '平', '黄', '和', '穆', '萧', '尹',8 '姚', '邵', '堪', '汪', '祁', '毛', '禹', '狄', '米', '贝', '明', '臧', '计', '伏', '成', '戴', '谈', '宋', '茅', '庞',9 '熊', '纪', '舒', '屈', '项', '祝', '董', '梁']10_first_names = ['的', '一', '是', '了', '我', '不', '人', '在', '他', '有', '这', '个', '上', '们', '来', '到', '时', '大', '地', '为',11 '子', '中', '你', '说', '生', '国', '年', '着', '就', '那', '和', '要', '她', '出', '也', '得', '里', '后', '自', '以',12 '会', '家', '可', '下', '而', '过', '天', '去', '能', '对', '小', '多', '然', '于', '心', '学', '么', '之', '都', '好',13 '看', '起', '发', '当', '没', '成', '只', '如', '事', '把', '还', '用', '第', '样', '道', '想', '作', '种', '开', '美',14 '总', '从', '无', '情', '己', '面', '最', '女', '但', '现', '前', '些', '所', '同', '日', '手', '又', '行', '意', '动',15 '方', '期', '它', '头', '经', '长', '儿', '回', '位', '分', '爱', '老', '因', '很', '给', '名', '法', '间', '斯', '知',16 '世', '什', '两', '次', '使', '身', '者', '被', '高', '已', '亲', '其', '进', '此', '话', '常', '与', '活', '正', '感',17 '见', '明', '问', '力', '理', '尔', '点', '文', '几', '定', '本', '公', '特', '做', '外', '孩', '相', '西', '果', '走',18 '将', '月', '十', '实', '向', '声', '车', '全', '信', '重', '三', '机', '工', '物', '气', '每', '并', '别', '真', '打',19 '太', '新', '比', '才', '便', '夫', '再', '书', '部', '水', '像', '眼', '等', '体', '却', '加', '电', '主', '界', '门',20 '利', '海', '受', '听', '表', '德', '少', '克', '代', '员', '许', '稜', '先', '口', '由', '死', '安', '写', '性', '马',21 '光', '白', '或', '住', '难', '望', '教', '命', '花', '结', '乐', '色', '更', '拉', '东', '神', '记', '处', '让', '母',22 '父', '应', '直', '字', '场', '平', '报', '友', '关', '放', '至', '张', '认', '接', '告', '入', '笑', '内', '英', '军',23 '候', '民', '岁', '往', '何', '度', '山', '觉', '路', '带', '万', '男', '边', '风', '解', '叫', '任', '金', '快', '原',24 '吃', '妈', '变', '通', '师', '立', '象', '数', '四', '失', '满', '战', '远', '格', '士', '音', '轻', '目', '条', '呢',25 '病', '始', '达', '深', '完', '今', '提', '求', '清', '王', '化', '空', '业', '思', '切', '怎', '非', '找', '片', '罗',26 '钱', '紶', '吗', '语', '元', '喜', '曾', '离', '飞', '科', '言', '干', '流', '欢', '约', '各', '即', '指', '合', '反',27 '题', '必', '该', '论', '交', '终', '林', '请', '医', '晚', '制', '球', '决', '窢', '传', '画', '保', '读', '运', '及',28 '则', '房', '早', '院', '量', '苦', '火', '布', '品', '近', '坐', '产', '答', '星', '精', '视', '五', '连', '司', '巴',29 '奇', '管', '类', '未', '朋', '且', '婚', '台', '夜', '青', '北', '队', '久', '乎', '越', '观', '落', '尽', '形', '影',30 '红', '爸', '百', '令', '周', '吧', '识', '步', '希', '亚', '术', '留', '市', '半', '热', '送', '兴', '造', '谈', '容',31 '极', '随', '演', '收', '首', '根', '讲', '整', '式', '取', '照', '办', '强', '石', '古', '华', '諣', '拿', '计', '您',32 '装', '似', '足', '双', '妻', '尼', '转', '诉', '米', '称', '丽', '客', '南', '领', '节', '衣', '站', '黑', '刻', '统',33 '断', '福', '城', '故', '历', '惊', '脸', '选', '包', '紧', '争', '另', '建', '维', '绝', '树', '系', '伤', '示', '愿',34 '持', '千', '史', '谁', '准', '联', '妇', '纪', '基', '买', '志', '静', '阿', '诗', '独', '复', '痛', '消', '社', '算',35 '义', '竟', '确', '酒', '需', '单', '治', '卡', '幸', '兰', '念', '举', '仅', '钟', '怕', '共', '毛', '句', '息', '功',36 '官', '待', '究', '跟', '穿', '室', '易', '游', '程', '号', '居', '考', '突', '皮', '哪', '费', '倒', '价', '图', '具',37 '刚', '脑', '永', '歌', '响', '商', '礼', '细', '专', '黄', '块', '脚', '味', '灵', '改', '据', '般', '破', '引', '食',38 '仍', '存', '众', '注', '笔', '甚', '某', '沉', '血', '备', '习', '校', '默', '务', '土', '微', '娘', '须', '试', '怀',39 '料', '调', '广', '蜖', '苏', '显', '赛', '查', '密', '议', '底', '列', '富', '梦', '错', '座', '参', '八', '除', '跑',40 '亮', '假', '印', '设', '线', '温', '虽', '掉', '京', '初', '养', '香', '停', '际', '致', '阳', '纸', '李', '纳', '验',41 '助', '激', '够', '严', '证', '帝', '饭', '忘', '趣', '支', '春', '集', '丈', '木', '研', '班', '普', '导', '顿', '睡',42 '展', '跳', '获', '艺', '六', '波', '察', '群', '皇', '段', '急', '庭', '创', '区', '奥', '器', '谢', '弟', '店', '否',43 '害', '草', '排', '背', '止', '组', '州', '朝', '封', '睛', '板', '角', '况', '曲', '馆', '育', '忙', '质', '河', '续',44 '哥', '呼', '若', '推', '境', '遇', '雨', '标', '姐', '充', '围', '案', '伦', '护', '冷', '警', '贝', '著', '雪', '索',45 '剧', '啊', '船', '险', '烟', '依', '斗', '值', '帮', '汉', '慢', '佛', '肯', '闻', '唱', '沙', '局', '伯', '族', '低',46 '玩', '资', '屋', '击', '速', '顾', '泪', '洲', '团', '圣', '旁', '堂', '兵', '七', '露', '园', '牛', '哭', '旅', '街',47 '劳', '型', '烈', '姑', '陈', '莫', '鱼', '异', '抱', '宝', '权', '鲁', '简', '态', '级', '票', '怪', '寻', '杀', '律',48 '胜', '份', '汽', '右', '洋', '范', '床', '舞', '秘', '午', '登', '楼', '贵', '吸', '责', '例', '追', '较', '职', '属',49 '渐', '左', '录', '丝', '牙', '党', '继', '托', '赶', '章', '智', '冲', '叶', '胡', '吉', '卖', '坚', '喝', '肉', '遗',50 '救', '修', '松', '临', '藏', '担', '戏', '善', '卫', '药', '悲', '敢', '靠', '伊', '村', '戴', '词', '森', '耳', '差',51 '短', '祖', '云', '规', '窗', '散', '迷', '油', '旧', '适', '乡', '架', '恩', '投', '弹', '铁', '博', '雷', '府', '压',52 '超', '负', '勒', '杂', '醒', '洗', '采', '毫', '嘴', '毕', '九', '冰', '既', '状', '乱', '景', '席', '珍', '童', '顶',53 '派', '素', '脱', '农', '疑', '练', '野', '按', '犯', '拍', '征', '坏', '骨', '余', '承', '置', '臓', '彩', '灯', '巨',54 '琴', '免', '环', '姆', '暗', '换', '技', '翻', '束', '增', '忍', '餐', '洛', '塞', '缺', '忆', '判', '欧', '层', '付',55 '阵', '玛', '批', '岛', '项', '狗', '休', '懂', '武', '革', '良', '恶', '恋', '委', '拥', '娜', '妙', '探', '呀', '营',56 '退', '摇', '弄', '桌', '熟', '诺', '宣', '银', '势', '奖', '宫', '忽', '套', '康', '供', '优', '课', '鸟', '喊', '降',57 '夏', '困', '刘', '罪', '亡', '鞋', '健', '模', '败', '伴', '守', '挥', '鲜', '财', '孤', '枪', '禁', '恐', '伙', '杰',58 '迹', '妹', '藸', '遍', '盖', '副', '坦', '牌', '江', '顺', '秋', '萨', '菜', '划', '授', '归', '浪', '听', '凡', '预',59 '奶', '雄', '升', '碃', '编', '典', '袋', '莱', '含', '盛', '济', '蒙', '棋', '端', '腿', '招', '释', '介', '烧', '误',60 '乾', '坤']61_department_list = ['采矿部', '公关部', '娱乐部', '小分队部', '掘进队', '赏金猎人']62def _random_str(size=1, choice_list=_last_names):63 """随机获取n个汉字"""64 string = ""65 for i in range(size):66 string += _choice(choice_list)67 return string68def _full_name():69 """生成名字"""70 return _random_str(1, _last_names) + _random_str(_choice(range(1, 3)), _first_names)71def _department_name():72 """生成部门"""73 return _choice(_department_list)74def random_employee_from_device(device):75 """从 device 中获取信息生成对应的员工对象"""76 return random_employee(device['GroupId'], device['DeviceId'], str(device['_id']))77def random_employee(group_id, device_id, device_object_id):78 """根据参数生成员工"""79 emp_item = {'Name': _full_name(),80 'Department': _department_name(),81 'GroupId': group_id,82 'DeviceId': device_id,83 'JobNumber': str(group_id)+str(device_id),84 'Sex': '男',85 'BornDate': datetime.utcnow(),86 'MaritalStatus': '',87 'National': '',88 'IdentityCardId': '',89 'NativePlace': '',90 'Address': '',91 'Blood': '',92 'Image': '',93 'PoliticalStatus': '群众',94 'Education': '高中',95 'PhoneNum': '0101234567',96 'ContractTypes': '',97 'Position': '',98 'JoinTime': datetime.utcnow(),99 'LampTypes': '',100 'Classes': '',101 'SelfRescuerId': '',102 'Others': '',103 'LampId': '',104 'SelfRescuerTypes': '',105 'DeviceObjectId': ''}106 if device_object_id:107 emp_item['DeviceObjectId'] = device_object_id...

Full Screen

Full Screen

sheets_gw.py

Source: sheets_gw.py Github

copy

Full Screen

...93 return success94 def get_first_names(self) -> List[str]:95 """Gets a list containing all user's first names"""96 return self._first_names97 def get_last_names(self) -> List[str]:98 """Gets a list containing all user's last names"""99 return self._last_names100 def get_user_ids(self) -> List[int]:101 """Gets a list of all user ids"""102 return self._user_ids103 def get_SINdex(self, sin: int) -> int:104 """If a user with <sin> exists, returns the index of that user.105 Otherwise, returns -1."""106 for i in range(0, len(self._user_SINs)):107 if int(self._user_SINs[i]) == sin:108 return i109 return -1110 def get_birthdays(self) -> List[int]:111 """Gets a list of all user birthdays"""...

Full Screen

Full Screen

full_name_splitter.py

Source: full_name_splitter.py Github

copy

Full Screen

1import re2LAST_NAME_PREFIXES = [3 "de",4 "da",5 "la",6 "du",7 "del",8 "dei",9 "vda.",10 "dello",11 "della",12 "degli",13 "delle",14 "van",15 "von",16 "der",17 "den",18 "heer",19 "ten",20 "ter",21 "vande",22 "vanden",23 "vander",24 "voor",25 "ver",26 "aan",27 "mc",28]29# Regular expresions30RE_INITIAL = re.compile(r"^\w\.?$", re.IGNORECASE)31RE_APOSTROPHE = re.compile(r"\w{1}\'\w+", re.IGNORECASE)32RE_COMPOUSED = re.compile(r"\w+\-\w+", re.IGNORECASE)33RE_SUFFIX = re.compile(34 r",? +(i{1,3}|iv|vi{0,3}|s(enio)?r|j(unio)?r|phd|apr|rph|pe|md|ma|dmd|cme)$",35 re.IGNORECASE,36)37RE_SALUTATION = re.compile(38 r"^(mrs?|m[ia]ster|miss|ms|d(octo)?r|prof|rev|fr|judge|honorable|hon|lord|lady)\.?$",39 re.IGNORECASE,40)41RE_EXCEPTIONS = re.compile(r"^(van der|(vda\.)? ?de la \w+$)", re.IGNORECASE)42RE_SPACES = re.compile(r"\s+")43class Splitter:44 def __init__(self, full_name):45 self._full_name = full_name46 self._first_names = []47 self._last_names = []48 self.split(self.tokens_fullname())49 def tokens_fullname(self):50 # Remove more than one spaces and suffix51 full_name_clean = RE_SUFFIX.sub("", RE_SPACES.sub(" ", self._full_name.strip()))52 if "," in full_name_clean:53 return full_name_clean.split(",")[1::-1]54 return [part for part in full_name_clean.split(" ") if part]55 def split(self, parts):56 while parts:57 part = parts.pop(0).strip()58 if (59 is_prefix(part)60 or has_apostrophe(part)61 or (self._first_names and not parts and not is_initial(part))62 ):63 self._last_names.append(part)64 break65 else:66 self._first_names.append(part)67 self._last_names.extend(parts)68 if self._first_names:69 if is_salutation(self._first_names[0]):70 self._first_names.pop(0)71 self.adjust_exceptions()72 def adjust_exceptions(self):73 # Adjusting exceptions like74 # "Ludwig Mies van der Rohe" => ["Ludwig", "Mies van der Rohe"]75 # "Juan Martín de la Cruz Gómez" => ["Juan Martín", "de la Cruz Gómez"]76 # "Javier Reyes de la Barrera" => ["Javier", "Reyes de la Barrera"]77 # "Rosa María Pérez Martínez Vda. de la Cruz"78 # => ["Rosa María", "Pérez Martínez Vda. de la Cruz"]79 if (80 len(self._first_names) > 181 and not is_initial(self._first_names[-1])82 and RE_EXCEPTIONS.match(" ".join(self._last_names))83 ):84 while True:85 self._last_names.insert(0, self._first_names.pop())86 if len(self._first_names) <= 2:87 break88 @property89 def full_name(self):90 return " ".join(self._first_names + self._last_names)91 @property92 def first_names(self):93 return " ".join(self._first_names)94 @property95 def last_names(self):96 return " ".join(self._last_names)97def is_prefix(part):98 return part.lower() in LAST_NAME_PREFIXES99def is_initial(part):100 return RE_INITIAL.match(part)101def has_apostrophe(part):102 return RE_APOSTROPHE.match(part)103def is_salutation(part):...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Joomla Testing Guide: How To Test Joomla Websites

Before we discuss the Joomla testing, let us understand the fundamentals of Joomla and how this content management system allows you to create and maintain web-based applications or websites without having to write and implement complex coding requirements.

Now Log Bugs Using LambdaTest and DevRev

In today’s world, an organization’s most valuable resource is its customers. However, acquiring new customers in an increasingly competitive marketplace can be challenging while maintaining a strong bond with existing clients. Implementing a customer relationship management (CRM) system will allow your organization to keep track of important customer information. This will enable you to market your services and products to these customers better.

Why Agile Teams Have to Understand How to Analyze and Make adjustments

How do we acquire knowledge? This is one of the seemingly basic but critical questions you and your team members must ask and consider. We are experts; therefore, we understand why we study and what we should learn. However, many of us do not give enough thought to how we learn.

27 Best Website Testing Tools In 2022

Testing is a critical step in any web application development process. However, it can be an overwhelming task if you don’t have the right tools and expertise. A large percentage of websites still launch with errors that frustrate users and negatively affect the overall success of the site. When a website faces failure after launch, it costs time and money to fix.

11 Best Mobile Automation Testing Tools In 2022

Mobile application development is on the rise like never before, and it proportionally invites the need to perform thorough testing with the right mobile testing strategies. The strategies majorly involve the usage of various mobile automation testing tools. Mobile testing tools help businesses automate their application testing and cut down the extra cost, time, and chances of human error.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run hypothesis automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful