Best Python code snippet using hypothesis
namecreater.py
Source: namecreater.py
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...
sheets_gw.py
Source: sheets_gw.py
...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_name_splitter.py
Source: full_name_splitter.py
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):...
Check out the latest blogs from LambdaTest on this topic:
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.
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.
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.
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.
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.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!