How to use not_first method in hypothesis

Best Python code snippet using hypothesis

excelField.py

Source:excelField.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-23import arcpy4import os5import xlwt6import xlrd7import numpy as np8import re910#функция, приводящая значения к типу str11def to_unicode(l):12 for i in range(1, len(l)):13 if type(l[i]) == long:14 l[i] = unicode(int(l[i]))15 elif type(l[i]) == float:16 l[i] = unicode(int(l[i]))17 elif type(l[i]) == int:18 l[i] = unicode(l[i])19 elif type(l[i]) == str:20 l[i] = unicode(l[i]) 21 elif type(l[i]) == unicode:22 pass23 else:24 arcpy.AddMessage('invalid field type: '+l[i])25 l[i] = '!?: '+str(l[i])26 return l2728#функция, удаляющая незначащие значения29def clean(l):30 for i in range(1, len(l)):31 if l[i]=='-' or l[i]=='—' or l[i]==u'МОГ':32 l[i] = ''33 return l3435#функция, выявляющая пустые ячейки обязательных для заполнения полей 36def full(l):37 for i in range(1, len(l)):38 if l[i]=='' or l[i] is None:39 l[i] = '!?: '40 return l4142#функция, заменяющая значения на соответствующие коды атрибутивного домена43def domen(l):44 for i in range(1, len(l)):45 if l[i].lower().find(u'не баланс') != -1:46 l[i] = 247 elif l[i].lower().find(u'баланс') != -1:48 l[i] = 149 elif l[i].lower().find(u'сельск') != -1:50 l[i] = 151 elif l[i].lower().find(u'город') != -1:52 l[i] = 253 elif l[i].lower().find(u'договор на то по заявке аб') != -1:54 l[i] = 255 elif l[i].lower().find(u'договор на то') != -1:56 l[i] = 157 elif l[i].lower().find(u'без договора на то') != -1:58 l[i] = 459 elif l[i].lower().find(u'бесхозяйные огх') != -1:60 l[i] = 99961 elif l[i].lower().find(u'огх сторонних организаций') != -1:62 l[i] = 563 elif l[i].lower().find(u'объекты министерства обороны') != -1:64 l[i] = 665 elif l[i].lower().find(u'договор аренды') != -1:66 l[i] = 367 elif l[i] == '':68 pass 69 else:70 arcpy.AddMessage('not in the domain: '+l[i])71 l[i] = '!?: '+l[i]72 73 return l7475reestr_path_list = arcpy.GetParameterAsText(0).split(';')76dest_folder = arcpy.GetParameterAsText(1)7778wb = xlwt.Workbook()79ws = wb.add_sheet('reestr',cell_overwrite_ok=True)8081err_style = xlwt.easyxf('pattern: pattern solid, fore_colour red;')82err2_style = xlwt.easyxf('pattern: pattern solid, fore_colour yellow;')83err3_style = xlwt.easyxf('pattern: pattern solid, fore_colour green;')8485tit = ['routeN', 'SGSegmN', 'ITDname', 'RightOwner', 'InventNum', 'commens', 'Contractor', 'passN', 'recordN', 'ContrNum', 'SGplase', 'KEY']8687offset = 0 #сдвиг нумерации строк таблицы, присоединяемой к предыдущей88not_first = 0 #параметр, определяющий добавление заголовка только для первой таблицы из всех соединяемых8990for file_location in reestr_path_list:91 92 workbook = xlrd.open_workbook(file_location)93 sheet = workbook.sheet_by_index(0)94 95 col_list = []9697 col_list.append(to_unicode(full(clean(sheet.col_values(0)))))98 col_list.append(to_unicode(full(clean(sheet.col_values(3)))))99 col_list.append(to_unicode(full(clean(sheet.col_values(5)))))100 col_list.append(full(domen(clean(sheet.col_values(6)))))101 col_list.append(to_unicode(clean(sheet.col_values(7))))102 col_list.append(to_unicode(clean(sheet.col_values(8))))103 col_list.append(domen(clean(sheet.col_values(9))))104 col_list.append(to_unicode(full(clean(sheet.col_values(10)))))105 col_list.append(to_unicode(full(clean(sheet.col_values(11)))))106 col_list.append(to_unicode(clean(sheet.col_values(15))))107 col_list.append(full(domen(clean(sheet.col_values(16)))))108109 #копируем значения в новую таблицу, заменяя значения на доменные коды и проверяя заполненность обязательных полей110 for i in range(0, len(col_list)):111 for j in range(0, len(col_list[i])-not_first):112 if unicode(col_list[i][j+not_first]).find('!?: ') != -1:113 ws.write(j+offset, i, col_list[i][j+not_first].replace('!?: ',''), err_style)114 else:115 ws.write(j+offset, i, col_list[i][j+not_first])116 117 #отмечаем желтым цветом несоответствие инвентарного номера балансовой принадлежности118 for i in range(0, len(col_list[3])-not_first):119 if col_list[3][i+not_first] == 1 and col_list[4][i+not_first] == '':120 ws.write(i+offset, 4, col_list[4][i+not_first], err2_style)121 elif col_list[3][i+not_first] == 2 and col_list[4][i+not_first] != '':122 ws.write(i+offset, 4, col_list[4][i+not_first], err2_style)123124 #отмечаем желтым цветом несоответствие вида договора балансовой принадлежности 125 for i in range(0, len(col_list[3])-not_first): 126 if col_list[3][i+not_first] == 1 and col_list[6][i+not_first] != '':127 if unicode(col_list[6][i+not_first]).find('!?: ')!= -1:128 ws.write(i+offset, 6, col_list[6][i+not_first].replace('!?: ',''), err2_style)129 else:130 ws.write(i+offset, 6, col_list[6][i+not_first], err2_style)131 elif col_list[3][i+not_first] == 2 and col_list[6][i+not_first] == '':132 ws.write(i+offset, 6, col_list[6][i+not_first], err2_style)133134 #отмечаем желтым цветом несоответствие номера договора балансовой принадлежности 135 for i in range(0, len(col_list[3])-not_first): 136 if col_list[3][i+not_first] == 1 and col_list[9][i+not_first] != '':137 ws.write(i+offset, 9, col_list[9][i+not_first], err2_style)138 elif col_list[3][i+not_first] == 2 and col_list[9][i+not_first] == '':139 ws.write(i+offset, 9, col_list[9][i+not_first], err2_style)140141 #заполняем поле KEY конкатенацией номера паспорта и номера записи, отмечая зеленым неуникальные значения142 key_list = []143 for i in range(0, len(col_list[7])-not_first):144 key_value = col_list[7][i+not_first]+'+'+col_list[8][i+not_first]145 if key_value in key_list:146 ws.write(i+offset, 11, key_value, err3_style)147 else:148 ws.write(i+offset, 11, key_value)149 key_list.append(key_value)150 151 #меняем заголовок таблицы на имена полей атрибутивной таблицы152 if not_first == 0:153 for i in range(0, len(tit)):154 ws.write(0, i, tit[i])155 156 offset += len(col_list[0]) - not_first157 not_first = 1158 ...

Full Screen

Full Screen

test_solid_aliases.py

Source:test_solid_aliases.py Github

copy

Full Screen

...13 @lambda_solid()14 def first():15 return ['first']16 @lambda_solid(input_defs=[InputDefinition(name="prev")])17 def not_first(prev):18 return prev + ['not_first']19 pipeline = PipelineDefinition(20 solid_defs=[first, not_first],21 dependencies={22 'not_first': {'prev': DependencyDefinition('first')},23 SolidInvocation('not_first', alias='second'): {24 'prev': DependencyDefinition('not_first')25 },26 SolidInvocation('not_first', alias='third'): {'prev': DependencyDefinition('second')},27 },28 )29 result = execute_pipeline(pipeline)30 assert result.success31 solid_result = result.result_for_solid('third')32 assert solid_result.output_value() == ['first', 'not_first', 'not_first', 'not_first']33def test_only_aliased_solids():34 @lambda_solid()35 def first():36 return ['first']37 @lambda_solid(input_defs=[InputDefinition(name="prev")])38 def not_first(prev):39 return prev + ['not_first']40 pipeline = PipelineDefinition(41 solid_defs=[first, not_first],42 dependencies={43 SolidInvocation('first', alias='the_root'): {},44 SolidInvocation('not_first', alias='the_consequence'): {45 'prev': DependencyDefinition('the_root')46 },47 },48 )49 result = execute_pipeline(pipeline)50 assert result.success51 solid_result = result.result_for_solid('the_consequence')52 assert solid_result.output_value() == ['first', 'not_first']...

Full Screen

Full Screen

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