How to use gds_str_lower method in autotest

Best Python code snippet using autotest_python

generateds_gui_session.py

Source:generateds_gui_session.py Github

copy

Full Screen

...75 def gds_format_double(self, input_data, input_name=''):76 return '%e' % input_data77 def gds_format_boolean(self, input_data, input_name=''):78 return '%s' % input_data79 def gds_str_lower(self, instring):80 return instring.lower()81 82 83#84# If you have installed IPython you can uncomment and use the following.85# IPython is available from http://ipython.scipy.org/.86#87## from IPython.Shell import IPShellEmbed88## args = ''89## ipshell = IPShellEmbed(args,90## banner = 'Dropping into IPython',91## exit_msg = 'Leaving Interpreter, back to program.')92# Then use the following line where and when you want to drop into the93# IPython shell:94# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit')95#96# Globals97#98ExternalEncoding = 'ascii'99Tag_pattern_ = re_.compile(r'({.*})?(.*)')100STRING_CLEANUP_PAT = re_.compile(r"[\n\r\s]+")101#102# Support/utility functions.103#104def showIndent(outfile, level):105 for idx in range(level):106 outfile.write(' ')107def quote_xml(inStr):108 if not inStr:109 return ''110 s1 = (isinstance(inStr, basestring) and inStr or111 '%s' % inStr)112 s1 = s1.replace('&', '&amp;')113 s1 = s1.replace('<', '&lt;')114 s1 = s1.replace('>', '&gt;')115 return s1116def quote_attrib(inStr):117 s1 = (isinstance(inStr, basestring) and inStr or118 '%s' % inStr)119 s1 = s1.replace('&', '&amp;')120 s1 = s1.replace('<', '&lt;')121 s1 = s1.replace('>', '&gt;')122 if '"' in s1:123 if "'" in s1:124 s1 = '"%s"' % s1.replace('"', "&quot;")125 else:126 s1 = "'%s'" % s1127 else:128 s1 = '"%s"' % s1129 return s1130def quote_python(inStr):131 s1 = inStr132 if s1.find("'") == -1:133 if s1.find('\n') == -1:134 return "'%s'" % s1135 else:136 return "'''%s'''" % s1137 else:138 if s1.find('"') != -1:139 s1 = s1.replace('"', '\\"')140 if s1.find('\n') == -1:141 return '"%s"' % s1142 else:143 return '"""%s"""' % s1144def get_all_text_(node):145 if node.text is not None:146 text = node.text147 else:148 text = ''149 for child in node:150 if child.tail is not None:151 text += child.tail152 return text153class GDSParseError(Exception):154 pass155def raise_parse_error(node, msg):156 if XMLParser_import_library == XMLParser_import_lxml:157 msg = '%s (element %s/line %d)' % (msg, node.tag, node.sourceline, )158 else:159 msg = '%s (element %s)' % (msg, node.tag, )160 raise GDSParseError(msg)161class MixedContainer:162 # Constants for category:163 CategoryNone = 0164 CategoryText = 1165 CategorySimple = 2166 CategoryComplex = 3167 # Constants for content_type:168 TypeNone = 0169 TypeText = 1170 TypeString = 2171 TypeInteger = 3172 TypeFloat = 4173 TypeDecimal = 5174 TypeDouble = 6175 TypeBoolean = 7176 def __init__(self, category, content_type, name, value):177 self.category = category178 self.content_type = content_type179 self.name = name180 self.value = value181 def getCategory(self):182 return self.category183 def getContenttype(self, content_type):184 return self.content_type185 def getValue(self):186 return self.value187 def getName(self):188 return self.name189 def export(self, outfile, level, name, namespace):190 if self.category == MixedContainer.CategoryText:191 # Prevent exporting empty content as empty lines.192 if self.value.strip(): 193 outfile.write(self.value)194 elif self.category == MixedContainer.CategorySimple:195 self.exportSimple(outfile, level, name)196 else: # category == MixedContainer.CategoryComplex197 self.value.export(outfile, level, namespace,name)198 def exportSimple(self, outfile, level, name):199 if self.content_type == MixedContainer.TypeString:200 outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name))201 elif self.content_type == MixedContainer.TypeInteger or \202 self.content_type == MixedContainer.TypeBoolean:203 outfile.write('<%s>%d</%s>' % (self.name, self.value, self.name))204 elif self.content_type == MixedContainer.TypeFloat or \205 self.content_type == MixedContainer.TypeDecimal:206 outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name))207 elif self.content_type == MixedContainer.TypeDouble:208 outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name))209 def exportLiteral(self, outfile, level, name):210 if self.category == MixedContainer.CategoryText:211 showIndent(outfile, level)212 outfile.write('model_.MixedContainer(%d, %d, "%s", "%s"),\n' % \213 (self.category, self.content_type, self.name, self.value))214 elif self.category == MixedContainer.CategorySimple:215 showIndent(outfile, level)216 outfile.write('model_.MixedContainer(%d, %d, "%s", "%s"),\n' % \217 (self.category, self.content_type, self.name, self.value))218 else: # category == MixedContainer.CategoryComplex219 showIndent(outfile, level)220 outfile.write('model_.MixedContainer(%d, %d, "%s",\n' % \221 (self.category, self.content_type, self.name,))222 self.value.exportLiteral(outfile, level + 1)223 showIndent(outfile, level)224 outfile.write(')\n')225class MemberSpec_(object):226 def __init__(self, name='', data_type='', container=0):227 self.name = name228 self.data_type = data_type229 self.container = container230 def set_name(self, name): self.name = name231 def get_name(self): return self.name232 def set_data_type(self, data_type): self.data_type = data_type233 def get_data_type_chain(self): return self.data_type234 def get_data_type(self):235 if isinstance(self.data_type, list):236 if len(self.data_type) > 0:237 return self.data_type[-1]238 else:239 return 'xs:string'240 else:241 return self.data_type242 def set_container(self, container): self.container = container243 def get_container(self): return self.container244def _cast(typ, value):245 if typ is None or value is None:246 return value247 return typ(value)248#249# Mixin class for additional behaviors.250#251class SessionTypeMixin(object):252 def copy(self):253 """Produce a copy of myself.254 """255 new_session = sessionType(256 input_schema = self.input_schema,257 output_superclass = self.output_superclass,258 output_subclass = self.output_subclass,259 force = self.force,260 prefix = self.prefix,261 namespace_prefix = self.namespace_prefix,262 empty_namespace_prefix = self.empty_namespace_prefix,263 behavior_filename = self.behavior_filename,264 properties = self.properties,265 subclass_suffix = self.subclass_suffix,266 root_element = self.root_element,267 superclass_module = self.superclass_module,268 auto_super = self.auto_super,269 old_getters_setters = self.old_getters_setters,270 validator_bodies = self.validator_bodies,271 user_methods = self.user_methods,272 no_dates = self.no_dates,273 no_versions = self.no_versions,274 no_process_includes = self.no_process_includes,275 silence = self.silence,276 namespace_defs = self.namespace_defs,277 external_encoding = self.external_encoding,278 member_specs = self.member_specs,279 )280 return new_session281 def __eq__(self, obj):282 """Implement the == operator.283 """284 if (285 obj.input_schema == self.input_schema and286 obj.output_superclass == self.output_superclass and287 obj.output_subclass == self.output_subclass and288 obj.force == self.force and289 obj.prefix == self.prefix and290 obj.namespace_prefix == self.namespace_prefix and291 obj.empty_namespace_prefix == self.empty_namespace_prefix and292 obj.behavior_filename == self.behavior_filename and293 obj.properties == self.properties and294 obj.subclass_suffix == self.subclass_suffix and295 obj.root_element == self.root_element and296 obj.superclass_module == self.superclass_module and297 obj.auto_super == self.auto_super and298 obj.old_getters_setters == self.old_getters_setters and299 obj.validator_bodies == self.validator_bodies and300 obj.user_methods == self.user_methods and301 obj.no_dates == self.no_dates and302 obj.no_versions == self.no_versions and303 obj.no_process_includes == self.no_process_includes and304 obj.silence == self.silence and305 obj.namespace_defs == self.namespace_defs and306 obj.external_encoding == self.external_encoding and307 obj.member_specs == self.member_specs):308 return True309 else:310 return False311 def __ne__(self, obj):312 """Implement the != operator.313 """314 return not self.__eq__(obj)315#316# Data representation classes.317#318class sessionType(GeneratedsSuper, SessionTypeMixin):319 member_data_items_ = [320 MemberSpec_('input_schema', 'xs:string', 0),321 MemberSpec_('output_superclass', 'xs:string', 0),322 MemberSpec_('output_subclass', 'xs:string', 0),323 MemberSpec_('force', 'xs:boolean', 0),324 MemberSpec_('prefix', 'xs:string', 0),325 MemberSpec_('namespace_prefix', 'xs:string', 0),326 MemberSpec_('empty_namespace_prefix', 'xs:boolean', 0),327 MemberSpec_('behavior_filename', 'xs:string', 0),328 MemberSpec_('properties', 'xs:boolean', 0),329 MemberSpec_('subclass_suffix', 'xs:string', 0),330 MemberSpec_('root_element', 'xs:string', 0),331 MemberSpec_('superclass_module', 'xs:string', 0),332 MemberSpec_('auto_super', 'xs:boolean', 0),333 MemberSpec_('old_getters_setters', 'xs:boolean', 0),334 MemberSpec_('validator_bodies', 'xs:string', 0),335 MemberSpec_('user_methods', 'xs:string', 0),336 MemberSpec_('no_dates', 'xs:boolean', 0),337 MemberSpec_('no_versions', 'xs:boolean', 0),338 MemberSpec_('no_process_includes', 'xs:boolean', 0),339 MemberSpec_('silence', 'xs:boolean', 0),340 MemberSpec_('namespace_defs', 'xs:string', 0),341 MemberSpec_('external_encoding', 'xs:string', 0),342 MemberSpec_('member_specs', 'xs:string', 0),343 ]344 subclass = None345 superclass = None346 def __init__(self, input_schema=None, output_superclass=None, output_subclass=None, force=None, prefix=None, namespace_prefix=None, empty_namespace_prefix=None, behavior_filename=None, properties=None, subclass_suffix=None, root_element=None, superclass_module=None, auto_super=None, old_getters_setters=None, validator_bodies=None, user_methods=None, no_dates=None, no_versions=None, no_process_includes=None, silence=None, namespace_defs=None, external_encoding=None, member_specs=None):347 self.input_schema = input_schema348 self.output_superclass = output_superclass349 self.output_subclass = output_subclass350 self.force = force351 self.prefix = prefix352 self.namespace_prefix = namespace_prefix353 self.empty_namespace_prefix = empty_namespace_prefix354 self.behavior_filename = behavior_filename355 self.properties = properties356 self.subclass_suffix = subclass_suffix357 self.root_element = root_element358 self.superclass_module = superclass_module359 self.auto_super = auto_super360 self.old_getters_setters = old_getters_setters361 self.validator_bodies = validator_bodies362 self.user_methods = user_methods363 self.no_dates = no_dates364 self.no_versions = no_versions365 self.no_process_includes = no_process_includes366 self.silence = silence367 self.namespace_defs = namespace_defs368 self.external_encoding = external_encoding369 self.member_specs = member_specs370 def factory(*args_, **kwargs_):371 if sessionType.subclass:372 return sessionType.subclass(*args_, **kwargs_)373 else:374 return sessionType(*args_, **kwargs_)375 factory = staticmethod(factory)376 def get_input_schema(self): return self.input_schema377 def set_input_schema(self, input_schema): self.input_schema = input_schema378 def get_output_superclass(self): return self.output_superclass379 def set_output_superclass(self, output_superclass): self.output_superclass = output_superclass380 def get_output_subclass(self): return self.output_subclass381 def set_output_subclass(self, output_subclass): self.output_subclass = output_subclass382 def get_force(self): return self.force383 def set_force(self, force): self.force = force384 def get_prefix(self): return self.prefix385 def set_prefix(self, prefix): self.prefix = prefix386 def get_namespace_prefix(self): return self.namespace_prefix387 def set_namespace_prefix(self, namespace_prefix): self.namespace_prefix = namespace_prefix388 def get_empty_namespace_prefix(self): return self.empty_namespace_prefix389 def set_empty_namespace_prefix(self, empty_namespace_prefix): self.empty_namespace_prefix = empty_namespace_prefix390 def get_behavior_filename(self): return self.behavior_filename391 def set_behavior_filename(self, behavior_filename): self.behavior_filename = behavior_filename392 def get_properties(self): return self.properties393 def set_properties(self, properties): self.properties = properties394 def get_subclass_suffix(self): return self.subclass_suffix395 def set_subclass_suffix(self, subclass_suffix): self.subclass_suffix = subclass_suffix396 def get_root_element(self): return self.root_element397 def set_root_element(self, root_element): self.root_element = root_element398 def get_superclass_module(self): return self.superclass_module399 def set_superclass_module(self, superclass_module): self.superclass_module = superclass_module400 def get_auto_super(self): return self.auto_super401 def set_auto_super(self, auto_super): self.auto_super = auto_super402 def get_old_getters_setters(self): return self.old_getters_setters403 def set_old_getters_setters(self, old_getters_setters): self.old_getters_setters = old_getters_setters404 def get_validator_bodies(self): return self.validator_bodies405 def set_validator_bodies(self, validator_bodies): self.validator_bodies = validator_bodies406 def get_user_methods(self): return self.user_methods407 def set_user_methods(self, user_methods): self.user_methods = user_methods408 def get_no_dates(self): return self.no_dates409 def set_no_dates(self, no_dates): self.no_dates = no_dates410 def get_no_versions(self): return self.no_versions411 def set_no_versions(self, no_versions): self.no_versions = no_versions412 def get_no_process_includes(self): return self.no_process_includes413 def set_no_process_includes(self, no_process_includes): self.no_process_includes = no_process_includes414 def get_silence(self): return self.silence415 def set_silence(self, silence): self.silence = silence416 def get_namespace_defs(self): return self.namespace_defs417 def set_namespace_defs(self, namespace_defs): self.namespace_defs = namespace_defs418 def get_external_encoding(self): return self.external_encoding419 def set_external_encoding(self, external_encoding): self.external_encoding = external_encoding420 def get_member_specs(self): return self.member_specs421 def set_member_specs(self, member_specs): self.member_specs = member_specs422 def export(self, outfile, level, namespace_='', name_='sessionType', namespacedef_=''):423 showIndent(outfile, level)424 outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))425 self.exportAttributes(outfile, level, [], namespace_, name_='sessionType')426 if self.hasContent_():427 outfile.write('>\n')428 self.exportChildren(outfile, level + 1, namespace_, name_)429 showIndent(outfile, level)430 outfile.write('</%s%s>\n' % (namespace_, name_))431 else:432 outfile.write('/>\n')433 def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='sessionType'):434 pass435 def exportChildren(self, outfile, level, namespace_='', name_='sessionType'):436 if self.input_schema is not None:437 showIndent(outfile, level)438 outfile.write('<%sinput_schema>%s</%sinput_schema>\n' % (namespace_, self.gds_format_string(quote_xml(self.input_schema).encode(ExternalEncoding), input_name='input_schema'), namespace_))439 if self.output_superclass is not None:440 showIndent(outfile, level)441 outfile.write('<%soutput_superclass>%s</%soutput_superclass>\n' % (namespace_, self.gds_format_string(quote_xml(self.output_superclass).encode(ExternalEncoding), input_name='output_superclass'), namespace_))442 if self.output_subclass is not None:443 showIndent(outfile, level)444 outfile.write('<%soutput_subclass>%s</%soutput_subclass>\n' % (namespace_, self.gds_format_string(quote_xml(self.output_subclass).encode(ExternalEncoding), input_name='output_subclass'), namespace_))445 if self.force is not None:446 showIndent(outfile, level)447 outfile.write('<%sforce>%s</%sforce>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.force)), input_name='force'), namespace_))448 if self.prefix is not None:449 showIndent(outfile, level)450 outfile.write('<%sprefix>%s</%sprefix>\n' % (namespace_, self.gds_format_string(quote_xml(self.prefix).encode(ExternalEncoding), input_name='prefix'), namespace_))451 if self.namespace_prefix is not None:452 showIndent(outfile, level)453 outfile.write('<%snamespace_prefix>%s</%snamespace_prefix>\n' % (namespace_, self.gds_format_string(quote_xml(self.namespace_prefix).encode(ExternalEncoding), input_name='namespace_prefix'), namespace_))454 if self.empty_namespace_prefix is not None:455 showIndent(outfile, level)456 outfile.write('<%sempty_namespace_prefix>%s</%sempty_namespace_prefix>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.empty_namespace_prefix)), input_name='empty_namespace_prefix'), namespace_))457 if self.behavior_filename is not None:458 showIndent(outfile, level)459 outfile.write('<%sbehavior_filename>%s</%sbehavior_filename>\n' % (namespace_, self.gds_format_string(quote_xml(self.behavior_filename).encode(ExternalEncoding), input_name='behavior_filename'), namespace_))460 if self.properties is not None:461 showIndent(outfile, level)462 outfile.write('<%sproperties>%s</%sproperties>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.properties)), input_name='properties'), namespace_))463 if self.subclass_suffix is not None:464 showIndent(outfile, level)465 outfile.write('<%ssubclass_suffix>%s</%ssubclass_suffix>\n' % (namespace_, self.gds_format_string(quote_xml(self.subclass_suffix).encode(ExternalEncoding), input_name='subclass_suffix'), namespace_))466 if self.root_element is not None:467 showIndent(outfile, level)468 outfile.write('<%sroot_element>%s</%sroot_element>\n' % (namespace_, self.gds_format_string(quote_xml(self.root_element).encode(ExternalEncoding), input_name='root_element'), namespace_))469 if self.superclass_module is not None:470 showIndent(outfile, level)471 outfile.write('<%ssuperclass_module>%s</%ssuperclass_module>\n' % (namespace_, self.gds_format_string(quote_xml(self.superclass_module).encode(ExternalEncoding), input_name='superclass_module'), namespace_))472 if self.auto_super is not None:473 showIndent(outfile, level)474 outfile.write('<%sauto_super>%s</%sauto_super>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.auto_super)), input_name='auto_super'), namespace_))475 if self.old_getters_setters is not None:476 showIndent(outfile, level)477 outfile.write('<%sold_getters_setters>%s</%sold_getters_setters>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.old_getters_setters)), input_name='old_getters_setters'), namespace_))478 if self.validator_bodies is not None:479 showIndent(outfile, level)480 outfile.write('<%svalidator_bodies>%s</%svalidator_bodies>\n' % (namespace_, self.gds_format_string(quote_xml(self.validator_bodies).encode(ExternalEncoding), input_name='validator_bodies'), namespace_))481 if self.user_methods is not None:482 showIndent(outfile, level)483 outfile.write('<%suser_methods>%s</%suser_methods>\n' % (namespace_, self.gds_format_string(quote_xml(self.user_methods).encode(ExternalEncoding), input_name='user_methods'), namespace_))484 if self.no_dates is not None:485 showIndent(outfile, level)486 outfile.write('<%sno_dates>%s</%sno_dates>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.no_dates)), input_name='no_dates'), namespace_))487 if self.no_versions is not None:488 showIndent(outfile, level)489 outfile.write('<%sno_versions>%s</%sno_versions>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.no_versions)), input_name='no_versions'), namespace_))490 if self.no_process_includes is not None:491 showIndent(outfile, level)492 outfile.write('<%sno_process_includes>%s</%sno_process_includes>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.no_process_includes)), input_name='no_process_includes'), namespace_))493 if self.silence is not None:494 showIndent(outfile, level)495 outfile.write('<%ssilence>%s</%ssilence>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.silence)), input_name='silence'), namespace_))496 if self.namespace_defs is not None:497 showIndent(outfile, level)498 outfile.write('<%snamespace_defs>%s</%snamespace_defs>\n' % (namespace_, self.gds_format_string(quote_xml(self.namespace_defs).encode(ExternalEncoding), input_name='namespace_defs'), namespace_))499 if self.external_encoding is not None:500 showIndent(outfile, level)501 outfile.write('<%sexternal_encoding>%s</%sexternal_encoding>\n' % (namespace_, self.gds_format_string(quote_xml(self.external_encoding).encode(ExternalEncoding), input_name='external_encoding'), namespace_))502 if self.member_specs is not None:503 showIndent(outfile, level)504 outfile.write('<%smember_specs>%s</%smember_specs>\n' % (namespace_, self.gds_format_string(quote_xml(self.member_specs).encode(ExternalEncoding), input_name='member_specs'), namespace_))505 def hasContent_(self):506 if (507 self.input_schema is not None or508 self.output_superclass is not None or509 self.output_subclass is not None or...

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 autotest 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