Best Python code snippet using freezegun
scalar.py
Source:scalar.py
...28 self.name = other.name29 self.value = other.value30 def __eq__(self,other):31 return (self.name == other.name and self.value == other.value)32 def __neq__(self,other):33 return (self.name != other.name or self.value != other.value)34 35 def isBool(self):36 return True37 38 def tostr(self):39 return (self.name,self.scalartype(),self.value)40 41 def __reduce__(self):42 return (BoolScalar, self.tostr(),)43class IntegerScalar (BaseScalar):44 def __init__(self, name, value = 1,minvalue = 0, maxvalue = 100):45 BaseScalar.__init__(self,name)46 self.value = value47 self.minvalue = minvalue48 self.maxvalue = maxvalue49 def importValue(self,other):50 self.name = other.name51 self.value = other.value52 self.minvalue = other.minvalue53 self.maxvalue = other.maxvalue54 55 def __eq__(self,other):56 return (self.name == other.name and self.value == other.value and 57 self.minvalue == other.minvalue and self.maxvalue == other.maxvalue)58 def __neq__(self,other):59 return (self.name != other.name or self.value != other.value or 60 self.minvalue != other.minvalue or self.maxvalue != other.maxvalue)61 62 def tostr(self):63 return (self.name,self.scalartype(),self.value,self.minvalue,self.maxvalue)64 65 def __reduce__(self):66 return (IntegerScalar, self.tostr(),)67 68class FloatScalar (BaseScalar):69 def __init__(self,name,value = 1.,minvalue = 0., maxvalue = 100., decimals = 2):70 BaseScalar.__init__(self,name)71 self.value = value72 self.minvalue = minvalue73 self.maxvalue = maxvalue74 self.decimals = decimals75 76 def importValue(self,other):77 self.name = other.name78 self.value = other.value79 self.minvalue = other.minvalue80 self.maxvalue = other.maxvalue81 self.decimals = other.decimals82 83 def __eq__(self,other):84 return (self.name == other.name and self.value == other.value and 85 self.minvalue == other.minvalue and self.maxvalue == other.maxvalue)86 87 def __neq__(self,other):88 return (self.name != other.name or self.value != other.value or 89 self.minvalue != other.minvalue or self.maxvalue != other.maxvalue)90 91 def isFloat(self):92 return True93 94 def tostr(self):95 return (self.name,self.scalartype(),self.value,self.minvalue,self.maxvalue, self.decimals)96 97 def __reduce__(self):98 return (FloatScalar, self.tostr(),)99 100class CategoryScalar (BaseScalar):101 def __init__(self, name):102 BaseScalar.__init__(self,name)103 104 def isCategory(self):105 return True106 107 def tostr(self):108 return (self.name, self.scalartype())109 def __reduce__(self):110 return (CategoryScalar, self.tostr(),) 111class EnumScalar (BaseScalar):112 def __init__(self,name,value = 0,values = []):113 BaseScalar.__init__(self,name)114 self.value = value115 self.values = values116 117 def importValue(self,other):118 self.name = other.name119 self.value = other.value120 self.values = other.values121 122 def __eq__(self,other):123 return (self.name == other.name and self.value == other.value and 124 self.values == other.values )125 126 def __neq__(self,other):127 return not self.__eq__(other)128 129 130 def tostr(self):131 return (self.name,self.scalartype(),self.value,self.values)132 133 def __reduce__(self):134 return (EnumScalar,self.tostr(),)135ScalarTypes = [ BoolScalar , IntegerScalar, FloatScalar, CategoryScalar, EnumScalar]136ScalarTypesDict = dict([(stype.scalartype(),stype) for stype in ScalarTypes])137def ProduceScalar(v):138 potentialtype = v[1]139 if type(potentialtype) == str: # The type of the scalar is stored140 w = list(v)...
system.py
Source:system.py
...12 def __gt__(self, other):13 return self + other14 def __eq__(self, other):15 return self == other16 def __neq__(self, other):17 return self != other18 def __str__(self, other):19 return str(self)20 def __int__(self, other):21 return bool(self)22 def __bool__(self, other):23 return bool(self)24class boolean():25 def __not__(self, other):26 return not self27 def __eq__(self, other):28 return self == other29 def __neq__(self, other):30 return self != other31 def __str__(self, other):32 return str(self)33 def __int__(self, other):34 return bool(self)35 def __bool__(self, other):36 return bool(self)37class string(): 38 def __add__(self, other):39 return self + other40 def __mul__(self, other):41 return self * other42 def __lt__(self, other):43 return self < other44 def __gt__(self, other):45 return self + other46 def __eq__(self, other):47 return self == other48 def __neq__(self, other):49 return self != other50 def __str__(self, other):51 return str(self)52 def __int__(self, other):53 return int(self)54 def __bool__(self, other):55 return bool(self)56 ...
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!!