How to use is_instances method in yandex-tank

Best Python code snippet using yandex-tank

constants.py

Source:constants.py Github

copy

Full Screen

...33 Context(vars=None, global_ctx=global_ctx, origcode=const.source_code),34 )35 annotation_type = global_ctx.parse_type(const.annotation.args[0], None)36 fail = False37 if is_instances([expr.typ, annotation_type], ByteArrayType):38 if expr.typ.maxlen < annotation_type.maxlen:39 return const40 fail = True41 elif expr.typ != annotation_type:42 fail = True43 # special case for literals, which can be uint256 types as well.44 is_special_case_uint256_literal = (45 is_instances([expr.typ, annotation_type], BaseType)46 ) and (47 [annotation_type.typ, expr.typ.typ] == ['uint256', 'int128']48 ) and SizeLimits.in_bounds('uint256', expr.value)49 is_special_case_int256_literal = (50 is_instances([expr.typ, annotation_type], BaseType)51 ) and (52 [annotation_type.typ, expr.typ.typ] == ['int128', 'int128']53 ) and SizeLimits.in_bounds('int128', expr.value)54 if is_special_case_uint256_literal or is_special_case_int256_literal:55 fail = False56 if fail:57 raise TypeMismatchException(58 'Invalid value for constant type, expected %r got %r instead' % (59 annotation_type,60 expr.typ,61 ),62 const.value,63 )64 ann_expr = copy.deepcopy(expr)...

Full Screen

Full Screen

singleitem.py

Source:singleitem.py Github

copy

Full Screen

1#!/usr/bin/env python32# -*- coding:utf-8 -*-3# author: bigfoolliu4"""5python实现单例6"""7class SingleItem(object):8 """通过重写__new__方法"""9 _instance = {}10 def __new__(cls, *args, **kwargs):11 if cls not in cls._instance:12 cls._instance[cls] = super().__new__(cls, *args, **kwargs)13 return cls._instance[cls]14def single_item(cls, *args, **kwargs):15 """通过闭包的方式"""16 is_instances = {}17 def get_instance():18 if cls not in is_instances:19 is_instances[cls] = cls(*args, **kwargs)20 return is_instances[cls]21 return get_instance22class A(SingleItem):23 def __init__(self, name, age=10):24 self.name = name25 self.age = age26a = A("jim")27b = A("tom") # 第二次实例化会被忽略...

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 yandex-tank 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