How to use __get__ method in avocado

Best Python code snippet using avocado_python

index.spec.js

Source:index.spec.js Github

copy

Full Screen

...19 expect(typeof lyftWebModal.onPostMessagesSuccess).toEqual('function');20 expect(typeof lyftWebModal.open).toEqual('function');21 });22 it('hides some methods', function () {23 expect(typeof lyftWebModal.__get__('createElements')).toEqual('function');24 expect(typeof lyftWebModal.__get__('bindEvents')).toEqual('function');25 expect(typeof lyftWebModal.__get__('updateContents')).toEqual('function');26 });27 describe('createElements', function () {28 var rootElement = {};29 var closeElement = {};30 var mapElement = {};31 var mapLabelNameElement = {};32 var mapLabelDescriptionElement = {};33 var frameBefore = {};34 var messageFormElement = {};35 var messageFormInputElement = {};36 var openAppCtaElement = {};37 var frameAfter = {};38 var frameAfterTextHeaderElement = {};39 beforeEach(function () {40 lyftWebModal.__set__('rootElement', rootElement);41 lyftWebModal.__set__('closeElement', closeElement);42 lyftWebModal.__set__('mapElement', mapElement);43 lyftWebModal.__set__('mapLabelNameElement', mapLabelNameElement);44 lyftWebModal.__set__('mapLabelDescriptionElement', mapLabelDescriptionElement);45 lyftWebModal.__set__('frameBefore', frameBefore);46 lyftWebModal.__set__('messageFormElement', messageFormElement);47 lyftWebModal.__set__('messageFormInputElement', messageFormInputElement);48 lyftWebModal.__set__('openAppCtaElement', openAppCtaElement);49 lyftWebModal.__set__('frameAfter', frameAfter);50 lyftWebModal.__set__('frameAfterTextHeaderElement', frameAfterTextHeaderElement);51 expect.spyOn(lyftWebModal.__get__('selector'), 'selectChildElement');52 });53 afterEach(function () {54 lyftWebModal.__get__('selector').selectChildElement.reset();55 });56 it('selects some elements from the template', function () {57 lyftWebModal.__get__('createElements')();58 expect(lyftWebModal.__get__('selector').selectChildElement)59 .toHaveBeenCalled();60 });61 it('sets some references to elements in the template', function () {62 lyftWebModal.__get__('createElements')();63 expect(lyftWebModal.__get__('rootElement'))64 .toNotEqual(rootElement);65 expect(lyftWebModal.__get__('closeElement'))66 .toNotEqual(closeElement);67 expect(lyftWebModal.__get__('mapElement'))68 .toNotEqual(mapElement);69 expect(lyftWebModal.__get__('mapLabelNameElement'))70 .toNotEqual(mapLabelNameElement);71 expect(lyftWebModal.__get__('mapLabelDescriptionElement'))72 .toNotEqual(mapLabelDescriptionElement);73 expect(lyftWebModal.__get__('frameBefore'))74 .toNotEqual(frameBefore);75 expect(lyftWebModal.__get__('messageFormElement'))76 .toNotEqual(messageFormElement);77 expect(lyftWebModal.__get__('messageFormInputElement'))78 .toNotEqual(messageFormInputElement);79 expect(lyftWebModal.__get__('openAppCtaElement'))80 .toNotEqual(openAppCtaElement);81 expect(lyftWebModal.__get__('frameAfter'))82 .toNotEqual(frameAfter);83 expect(lyftWebModal.__get__('frameAfterTextHeaderElement'))84 .toNotEqual(frameAfterTextHeaderElement);85 });86 it('returns the root element from the template', function () {87 var result = lyftWebModal.__get__('createElements')();88 expect(Object.prototype.toString.call(result))89 .toEqual('[object HTMLDivElement]');90 });91 });92 describe('bindEvents', function () {93 it('binds an event to rootElement if rootElement is defined', function () {94 lyftWebModal.__set__('rootElement', {});95 lyftWebModal.__get__('bindEvents')();96 expect(typeof lyftWebModal.__get__('rootElement').onclick)97 .toEqual('function');98 });99 it('does not bind an event to rootElement if rootElement is undefined', function () {100 lyftWebModal.__set__('rootElement', undefined);101 lyftWebModal.__get__('bindEvents')();102 expect(lyftWebModal.__get__('rootElement'))103 .toEqual(undefined);104 });105 it('binds an event to closeElement if closeElement is defined', function () {106 lyftWebModal.__set__('closeElement', {});107 lyftWebModal.__get__('bindEvents')();108 expect(typeof lyftWebModal.__get__('closeElement').onclick)109 .toEqual('function');110 });111 it('does not bind an event to closeElement if closeElement is undefined', function () {112 lyftWebModal.__set__('closeElement', undefined);113 lyftWebModal.__get__('bindEvents')();114 expect(lyftWebModal.__get__('closeElement'))115 .toEqual(undefined);116 });117 it('binds an event to messageFormElement if messageFormElement is defined', function () {118 lyftWebModal.__set__('messageFormElement', {});119 lyftWebModal.__get__('bindEvents')();120 expect(typeof lyftWebModal.__get__('messageFormElement').onsubmit)121 .toEqual('function');122 });123 it('does not bind an event to messageFormElement if messageFormElement is undefined', function () {124 lyftWebModal.__set__('messageFormElement', undefined);125 lyftWebModal.__get__('bindEvents')();126 expect(lyftWebModal.__get__('messageFormElement'))127 .toEqual(undefined);128 });129 });130 describe('updateContents', function () {131 var googleApiKey = 'someGoogleApiKey';132 var mockLocation = {133 address: 'someAddress',134 latitude: 'someLatitude',135 longitude: 'someLongitude',136 name: 'someName'137 };138 it('updates mapElement contents if mapElement is defined', function () {139 lyftWebModal.__set__('mapElement', {});140 lyftWebModal.__get__('updateContents')(googleApiKey, mockLocation);141 expect(lyftWebModal.__get__('mapElement').style.indexOf(googleApiKey))142 .toNotEqual(-1);143 expect(lyftWebModal.__get__('mapElement').style.indexOf(mockLocation.latitude))144 .toNotEqual(-1);145 expect(lyftWebModal.__get__('mapElement').style.indexOf(mockLocation.longitude))146 .toNotEqual(-1);147 });148 it('does not update mapElement contents if mapElement is undefined', function () {149 lyftWebModal.__set__('mapElement', undefined);150 lyftWebModal.__get__('updateContents')(googleApiKey, mockLocation);151 expect(lyftWebModal.__get__('mapElement'))152 .toEqual(undefined);153 });154 it('updates mapLabelNameElement contents if mapLabelNameElement is defined', function () {155 lyftWebModal.__set__('mapLabelNameElement', {});156 lyftWebModal.__get__('updateContents')(googleApiKey, mockLocation);157 expect(lyftWebModal.__get__('mapLabelNameElement').textContent)158 .toEqual(mockLocation.name);159 });160 it('does not update mapLabelNameElement contents if mapLabelNameElement is undefined', function () {161 lyftWebModal.__set__('mapLabelNameElement', undefined);162 lyftWebModal.__get__('updateContents')(googleApiKey, mockLocation);163 expect(lyftWebModal.__get__('mapLabelNameElement'))164 .toEqual(undefined);165 });166 it('updates mapLabelDescriptionElement contents if mapLabelDescriptionElement is defined', function () {167 lyftWebModal.__set__('mapLabelDescriptionElement', {});168 lyftWebModal.__get__('updateContents')(googleApiKey, mockLocation);169 expect(lyftWebModal.__get__('mapLabelDescriptionElement').textContent)170 .toEqual(mockLocation.address);171 });172 it('does not update mapLabelDescriptionElement contents if mapLabelDescriptionElement is undefined', function () {173 lyftWebModal.__set__('mapLabelDescriptionElement', undefined);174 lyftWebModal.__get__('updateContents')(googleApiKey, mockLocation);175 expect(lyftWebModal.__get__('mapLabelDescriptionElement'))176 .toEqual(undefined);177 });178 it('updates openAppCtaElement contents if openAppCtaElement is defined', function () {179 lyftWebModal.__set__('openAppCtaElement', {});180 lyftWebModal.__get__('updateContents')(googleApiKey, mockLocation);181 expect(lyftWebModal.__get__('openAppCtaElement').href.indexOf(mockLocation.latitude))182 .toNotEqual(-1);183 expect(lyftWebModal.__get__('openAppCtaElement').href.indexOf(mockLocation.longitude))184 .toNotEqual(-1);185 });186 it('does not update openAppCtaElement contents if openAppCtaElement is undefined', function () {187 lyftWebModal.__set__('openAppCtaElement', undefined);188 lyftWebModal.__get__('updateContents')(googleApiKey, mockLocation);189 expect(lyftWebModal.__get__('openAppCtaElement'))190 .toEqual(undefined);191 });192 });193 describe('onPostMessagesSuccess', function () {194 var value = 'someValue';195 beforeEach(function () {196 expect.spyOn(lyftWebModal.__get__('selector'), 'removeClass');197 expect.spyOn(lyftWebModal.__get__('selector'), 'addClass');198 });199 afterEach(function () {200 lyftWebModal.__get__('selector').removeClass.reset();201 lyftWebModal.__get__('selector').addClass.reset();202 });203 it('updates the user interface if data is truthy', function () {204 lyftWebModal.__set__('messageFormInputElement', {value: value});205 lyftWebModal.__set__('frameAfterTextHeaderElement', {});206 lyftWebModal.__set__('frameBefore', {className: 'frame-before on'});207 lyftWebModal.__set__('frameAfter', {className: 'frame-after'});208 lyftWebModal.onPostMessagesSuccess({messages: true});209 expect(lyftWebModal.__get__('frameAfterTextHeaderElement').textContent.indexOf(value))210 .toNotEqual(-1);211 expect(lyftWebModal.__get__('selector').removeClass)212 .toHaveBeenCalledWith(lyftWebModal.__get__('frameBefore'), 'on');213 expect(lyftWebModal.__get__('selector').addClass)214 .toHaveBeenCalledWith(lyftWebModal.__get__('frameAfter'), 'on');215 });216 it('does not update the user interface if data is falsey', function () {217 lyftWebModal.__set__('messageFormInputElement', {value: value});218 lyftWebModal.__set__('frameAfterTextHeaderElement', {});219 lyftWebModal.__set__('frameBefore', {className: 'frame-before on'});220 lyftWebModal.__set__('frameAfter', {className: 'frame-after'});221 lyftWebModal.onPostMessagesSuccess({messages: false});222 expect(lyftWebModal.__get__('frameAfterTextHeaderElement').textContent)223 .toEqual(undefined);224 expect(lyftWebModal.__get__('selector').removeClass)225 .toNotHaveBeenCalled();226 expect(lyftWebModal.__get__('selector').addClass)227 .toNotHaveBeenCalled();228 });229 it('updates the style of the frames', function (done) {230 lyftWebModal.__set__('messageFormInputElement', {value: value});231 lyftWebModal.__set__('frameAfterTextHeaderElement', {});232 lyftWebModal.__set__('frameBefore', {className: 'frame-before on'});233 lyftWebModal.__set__('frameAfter', {className: 'frame-after'});234 lyftWebModal.onPostMessagesSuccess({messages: true});235 setTimeout(function () {236 expect(lyftWebModal.__get__('frameBefore').style)237 .toNotEqual(undefined);238 expect(lyftWebModal.__get__('frameAfter').style)239 .toNotEqual(undefined);240 done();241 }, 500);242 });243 });244 describe('open', function () {245 var parentElement;246 beforeEach(function () {247 parentElement = {248 childNodes: ['someChildNode'],249 insertBefore: expect.createSpy()250 };251 lyftWebModal.__set__('parentElement', parentElement);252 expect.spyOn(lyftWebModal.__get__('selector'), 'addClass');253 });254 afterEach(function () {255 parentElement = undefined;256 lyftWebModal.__get__('selector').addClass.reset();257 });258 it('inserts the template into the DOM', function () {259 lyftWebModal.__set__('rootElement', {className: 'rootElement'});260 lyftWebModal.open();261 expect(parentElement.insertBefore)262 .toHaveBeenCalledWith(263 lyftWebModal.__get__('rootElement'),264 parentElement.childNodes[0]265 );266 });267 it('adds a class to rootElement', function (done) {268 lyftWebModal.__set__('rootElement', {className: 'rootElement'});269 lyftWebModal.open();270 setTimeout(function () {271 expect(lyftWebModal.__get__('selector').addClass)272 .toHaveBeenCalledWith(lyftWebModal.__get__('rootElement'), 'on');273 done();274 }, 110);275 });276 });277 describe('close', function () {278 beforeEach(function () {279 expect.spyOn(lyftWebModal.__get__('selector'), 'removeClass');280 });281 afterEach(function () {282 lyftWebModal.__get__('selector').removeClass.reset();283 });284 it('removes a class from rootElement', function () {285 lyftWebModal.__set__('rootElement', {className: 'rootElement on'});286 lyftWebModal.close();287 expect(lyftWebModal.__get__('selector').removeClass)288 .toHaveBeenCalledWith(lyftWebModal.__get__('rootElement'), 'on');289 });290 it('removes rootElement from the DOM', function (done) {291 lyftWebModal.__set__('rootElement', {292 className: 'rootElement',293 parentElement: {294 removeChild: expect.createSpy()295 }296 });297 lyftWebModal.close();298 setTimeout(function () {299 expect(lyftWebModal.__get__('rootElement').parentElement.removeChild)300 .toHaveBeenCalledWith(lyftWebModal.__get__('rootElement'));301 done();302 }, 500);303 });304 });305 describe('initialize', function () {306 var options = {307 clientId: 'someClientId',308 clientToken: 'someClientToken',309 googleApiKey: 'someGoogleApiKey',310 location: {311 latitude: 'someEndLatitude',312 longitude: 'someEndLongitude'313 },314 objectName: 'someObjectName',315 parentElement: 'someParentElement'316 };317 beforeEach(function () {318 expect.spyOn(lyftWebModal.__get__('api'), 'setClientId');319 expect.spyOn(lyftWebModal.__get__('api'), 'setClientToken');320 lyftWebModal.__set__('createElements', expect.createSpy());321 lyftWebModal.__set__('bindEvents', expect.createSpy());322 lyftWebModal.__set__('updateContents', expect.createSpy());323 });324 afterEach(function () {325 lyftWebModal.__get__('api').setClientId.reset();326 lyftWebModal.__get__('api').setClientToken.reset();327 lyftWebModal.__get__('createElements').reset();328 lyftWebModal.__get__('bindEvents').reset();329 lyftWebModal.__get__('updateContents').reset();330 });331 it('sets parentElement', function () {332 lyftWebModal.initialize(options);333 expect(lyftWebModal.__get__('parentElement'))334 .toEqual(options.parentElement);335 });336 it('sets client_id', function () {337 lyftWebModal.initialize(options);338 expect(lyftWebModal.__get__('api').setClientId)339 .toHaveBeenCalledWith(options.clientId);340 });341 it('sets client_token', function () {342 lyftWebModal.initialize(options);343 expect(lyftWebModal.__get__('api').setClientToken)344 .toHaveBeenCalledWith(options.clientToken);345 });346 it('creates elements', function () {347 lyftWebModal.initialize(options);348 expect(lyftWebModal.__get__('createElements'))349 .toHaveBeenCalled();350 });351 it('binds events', function () {352 lyftWebModal.initialize(options);353 expect(lyftWebModal.__get__('bindEvents'))354 .toHaveBeenCalledWith(options.location, options.objectName);355 });356 it('updates contents', function () {357 lyftWebModal.initialize(options);358 expect(lyftWebModal.__get__('updateContents'))359 .toHaveBeenCalledWith(options.googleApiKey, options.location);360 });361 });...

Full Screen

Full Screen

test_option.py

Source:test_option.py Github

copy

Full Screen

...16 opt_ip = OptIP("", "Test IP Description")17 assert opt_ip.description == "Test IP Description"18 assert opt_ip.display_value == ""19 assert opt_ip.value == ""20 assert opt_ip.__get__(None, None) == ""21 # Test OptIP setting to empty value22 opt_ip.__set__(None, "")23 assert opt_ip.value == ""24 assert opt_ip.display_value == ""25 assert opt_ip.__get__(None, None) == ""26 # Test OptIP setting to 192.168.1.127 opt_ip.__set__(None, "192.168.1.1")28 assert opt_ip.value == "192.168.1.1"29 assert opt_ip.display_value == "192.168.1.1"30 assert opt_ip.__get__(None, None) == "192.168.1.1"31 # Test OptIP setting to InvalidIP value32 try:33 opt_ip.__set__(None, "InvalidIP")34 assert False35 except OptionValidationError:36 assert True37def test_opt_port():38 # Test OptPort creation39 opt_port = OptPort(80, "Test Port Description")40 assert opt_port.description == "Test Port Description"41 assert opt_port.display_value == "80"42 assert opt_port.value == 8043 assert opt_port.__get__(None, None) == 8044 # Test OptPort setting to 444445 opt_port.__set__(None, 4444)46 assert opt_port.display_value == "4444"47 assert opt_port.value == 444448 assert opt_port.__get__(None, None) == 444449 # Test OptPort setting to 050 try:51 opt_port.__set__(None, 0)52 assert False53 except OptionValidationError:54 assert True55 # Test OptPort setting to 6553656 try:57 opt_port.__set__(None, 65536)58 assert False59 except OptionValidationError:60 assert True61def test_opt_bool():62 # Test OptBool creation63 opt_bool = OptBool(True, "Test Bool Description")64 assert opt_bool.description == "Test Bool Description"65 assert opt_bool.display_value == "true"66 assert opt_bool.value67 assert opt_bool.__get__(None, None)68 # Test OptBool setting to false69 opt_bool.__set__(None, "false")70 assert opt_bool.display_value == "false"71 assert not opt_bool.value72 assert not opt_bool.__get__(None, None)73 # Test OptBool setting to true74 opt_bool.__set__(None, "true")75 assert opt_bool.display_value == "true"76 assert opt_bool.value77 assert opt_bool.__get__(None, None)78 # Test OptBool setting to invalid value79 try:80 opt_bool.__set__(None, "Invalid Value")81 assert False82 except OptionValidationError:83 assert True84def test_opt_integer():85 # Test OptInteger creation86 opt_integer = OptInteger(4444, "Test Integer Description")87 assert opt_integer.description == "Test Integer Description"88 assert opt_integer.display_value == "4444"89 assert opt_integer.value == 444490 assert opt_integer.__get__(None, None) == 444491 # Test OptInteger setting to -192 opt_integer.__set__(None, -1)93 assert opt_integer.display_value == "-1"94 assert opt_integer.value == -195 assert opt_integer.__get__(None, None) == -196 # Test OptInteger setting to 999999997 opt_integer.__set__(None, 9999999)98 assert opt_integer.display_value == "9999999"99 assert opt_integer.value == 9999999100 assert opt_integer.__get__(None, None) == 9999999101 # Test OptInteger setting to 0102 opt_integer = OptInteger(0, "Test Integer with 0")103 assert opt_integer.display_value == "0"104 assert opt_integer.value == 0105 assert opt_integer.__get__(None, None) == 0106 # Test OptInteger setting to 0x100107 opt_integer.__set__(None, "0x100")108 assert opt_integer.display_value == "0x100"109 assert opt_integer.value == 0x100110 assert opt_integer.__get__(None, None) == 0x100111 # Test OptInteget setting to invalid value112 try:113 opt_integer.__set__(None, "Invalid Value")114 assert False115 except OptionValidationError:116 assert True117def test_opt_float():118 # Test OptFloat creation119 opt_float = OptFloat(3.14, "Test Float Description")120 assert opt_float.description == "Test Float Description"121 assert opt_float.display_value == "3.14"122 assert opt_float.value == 3.14123 assert opt_float.__get__(None, None) == 3.14124 # Test OptFloat setting to -1125 opt_float.__set__(None, -1)126 assert opt_float.display_value == "-1"127 assert opt_float.value == -1128 assert opt_float.__get__(None, None) == -1129 # Test OptFloat setting to 999.9999130 opt_float.__set__(None, 999.9999)131 assert opt_float.display_value == "999.9999"132 assert opt_float.value == 999.9999133 assert opt_float.__get__(None, None) == 999.9999134 # Test OptFloat setting to invalid value135 try:136 opt_float.__set__(None, "Invalid Value")137 assert False138 except OptionValidationError:139 assert True140def test_opt_string():141 # Test OptString creation142 opt_string = OptString("Test", "Test String Description")143 assert opt_string.description == "Test String Description"144 assert opt_string.display_value == "Test"145 assert opt_string.value == "Test"146 assert opt_string.__get__(None, None) == "Test"147 # Test OptString setting to "AAAABBBBCCCCDDDD"148 opt_string.__set__(None, "AAAABBBBCCCCDDDD")149 assert opt_string.display_value == "AAAABBBBCCCCDDDD"150 assert opt_string.value == "AAAABBBBCCCCDDDD"151 assert opt_string.__get__(None, None) == "AAAABBBBCCCCDDDD"152def test_opt_mac():153 # Test OptMAC creation154 opt_mac = OptMAC("AA:BB:CC:DD:EE:FF", "Test MAC Description")155 assert opt_mac.description == "Test MAC Description"156 assert opt_mac.display_value == "AA:BB:CC:DD:EE:FF"157 assert opt_mac.value == "AA:BB:CC:DD:EE:FF"158 assert opt_mac.__get__(None, None) == "AA:BB:CC:DD:EE:FF"159 # Test OptMAC setting to dd:ee:ff:dd:ee:ff160 opt_mac.__set__(None, "dd:ee:ff:dd:ee:ff")161 assert opt_mac.display_value == "dd:ee:ff:dd:ee:ff"162 assert opt_mac.value == "dd:ee:ff:dd:ee:ff"163 assert opt_mac.__get__(None, None) == "dd:ee:ff:dd:ee:ff"164 # Test OptMAC setting to invalid value165 try:166 opt_mac.__set__(None, "Invalid Value")167 assert False168 except OptionValidationError:169 assert True170def test_opt_wordlist():171 # Test OptWordlist creation172 opt_wordlist = OptWordlist("", "Test Wordlist Description")173 assert opt_wordlist.description == "Test Wordlist Description"174 assert opt_wordlist.display_value == ""175 assert opt_wordlist.value == ""176 assert opt_wordlist.__get__(None, None) == [""]177 # Test OptWordlist setting to admin,test178 opt_wordlist.__set__(None, "admin,test")179 assert opt_wordlist.display_value == "admin,test"180 assert opt_wordlist.value == "admin,test"181 assert opt_wordlist.__get__(None, None) == ["admin", "test"]182def test_opt_encoder():183 # Test OptEncoder creation184 opt_encoder = OptEncoder(PHPHexEncoder(), "Test Encoder Description")185 assert opt_encoder.description == "Test Encoder Description"186 assert str(opt_encoder.display_value) == "php/hex"...

Full Screen

Full Screen

__init__.py

Source:__init__.py Github

copy

Full Screen

...24 if i.find_element_by_xpath(".//label/p").text.strip(" :") == self.name:25 return i26 except NoSuchElementException:27 pass28 def __get__(self, instance, owner) -> Any:29 """30 :param instance: instance应该是存在element,调用get时会根据相对定位找到匹配name的input31 :param owner:32 :return: input33 """34 element: WebElement = instance.element35 input_ = self._match_input(element)36 return self.OBJ(input_)37 def __set__(self, instance, value):38 element: WebElement = instance.element39 input_ = self._match_input(element)40 self.OBJ(input_).value = value41class CheckBoxGroupComponent(BaseInputComponent):42 """复选框组"""43 OBJ = CheckBoxGroupInput44 def __get__(self, instance, owner) -> CheckBoxGroupInput:45 return super(CheckBoxGroupComponent, self).__get__(instance, owner)46class DateInputComponent(BaseInputComponent):47 """日期"""48 OBJ = DateInput49 def __get__(self, instance, owner) -> DateInput:50 return super(DateInputComponent, self).__get__(instance, owner)51class RadioGroupComponent(BaseInputComponent):52 """单选按钮组"""53 OBJ = RadioGroupInput54 def __get__(self, instance, owner) -> RadioGroupInput:55 return super(RadioGroupComponent, self).__get__(instance, owner)56class NativeSelectComponent(BaseInputComponent):57 """下拉单选框"""58 OBJ = NativeSelectInput59 def __get__(self, instance, owner) -> NativeSelectInput:60 return super(NativeSelectComponent, self).__get__(instance, owner)61class MuiSelectInputComponent(BaseInputComponent):62 """多选下拉框"""63 OBJ = MuiSelectInput64 def __get__(self, instance, owner) -> MuiSelectInput:65 return super(MuiSelectInputComponent, self).__get__(instance, owner)66class SearchSelectInputComponent(BaseInputComponent):67 """搜索下拉框"""68 OBJ = MuiSelectInput69 def __get__(self, instance, owner) -> SearchSelectInput:70 return super(SearchSelectInputComponent, self).__get__(instance, owner)71class TextInputComponent(BaseInputComponent):72 """文本输入框"""73 OBJ = TextInput74 def __get__(self, instance, owner) -> TextInput:75 return super(TextInputComponent, self).__get__(instance, owner)76class TextAreaInputComponent(BaseInputComponent):77 """文本输入框"""78 OBJ = TextAreaInput79 def __get__(self, instance, owner) -> TextAreaInput:80 return super(TextAreaInputComponent, self).__get__(instance, owner)81class NumberInputComponent(BaseInputComponent):82 """数字输入框"""83 OBJ = TextInput84 def __get__(self, instance, owner) -> NumberInput:85 return super(NumberInputComponent, self).__get__(instance, owner)86class TitleInputComponent(BaseInputComponent):87 """文本字段,无输入"""88 OBJ = DisableTextInput89 def __get__(self, instance, owner) -> DisableTextInput:90 return super(TitleInputComponent, self).__get__(instance, owner)91class NoLabelTextInputComponent(BaseInputComponent):92 """输入框"""93 OBJ = NoLabelTextInput94 def __get__(self, instance, owner) -> NoLabelTextInput:95 return super(NoLabelTextInputComponent, self).__get__(instance, owner)96class TextGroupComponent(BaseInputComponent):97 """输入框组"""98 OBJ = TextGroupInput99 def __get__(self, instance, owner) -> TextGroupInput:100 return super(TextGroupComponent, self).__get__(instance, owner)101class SelectAndTextGroupComponent(BaseInputComponent):102 """下拉框+输入框"""103 OBJ = SelectAndTextGroupInput104 def __get__(self, instance, owner) -> SelectAndTextGroupInput:105 return super(SelectAndTextGroupComponent, self).__get__(instance, owner)106class MuiSelectAndTextGroupComponent(BaseInputComponent):107 """多选的下拉框+输入框"""108 OBJ = MuiSelectAndTextGroupInput109 def __get__(self, instance, owner) -> MuiSelectAndTextGroupInput:110 return super(MuiSelectAndTextGroupComponent, self).__get__(instance, owner)111class SelectAndDateComponent(BaseInputComponent):112 """下拉框+日期"""113 OBJ = SelectAndDateInput114 def __get__(self, instance, owner) -> SelectAndDateInput:115 return super(SelectAndDateComponent, self).__get__(instance, owner)116class MuiSelectAndDateComponent(BaseInputComponent):117 """多选下拉框+日期"""118 OBJ = MuiSelectAndDateInput119 def __get__(self, instance, owner) -> MuiSelectAndDateInput:120 return super(MuiSelectAndDateComponent, self).__get__(instance, owner)121class CheckBoxGroupAndTextComponent(BaseInputComponent):122 """复选框组+输入框"""123 OBJ = CheckBoxGroupAndTextInput124 def __get__(self, instance, owner) -> CheckBoxGroupAndTextInput:125 return super(CheckBoxGroupAndTextComponent, self).__get__(instance, owner)126__all__ = ["CheckBoxGroupAndTextComponent", "CheckBoxGroupComponent", "TextGroupComponent", "SelectAndDateComponent",127 "MuiSelectAndDateComponent", "MuiSelectInputComponent", "SearchSelectInputComponent", "DateInputComponent",128 "NumberInputComponent", "TitleInputComponent", "TextInputComponent",129 "NoLabelTextInputComponent", "RadioGroupComponent", "SelectAndTextGroupComponent", "NativeSelectComponent",...

Full Screen

Full Screen

test1.js

Source:test1.js Github

copy

Full Screen

1DART = __get__(dict, "__call__")([], {"js_object": [{"key": "time", "value": __get__(dict, "__call__")([], {"js_object": [{"key": "time", "value": "time() { return new DateTime.now().millisecondsSinceEpoch / 1000.0; }"}]})}]});2JS = __get__(dict, "__call__")([], {"js_object": [{"key": "time", "value": __get__(dict, "__call__")([], {"js_object": [{"key": "time", "value": "function time() { return new Date().getTime() / 1000.0; }"}, {"key": "clock", "value": "function clock() { return new Date().getTime() / 1000.0; }"}]})}, {"key": "random", "value": __get__(dict, "__call__")([], {"js_object": [{"key": "random", "value": "var random = Math.random"}]})}, {"key": "bisect", "value": __get__(dict, "__call__")([], {"js_object": [{"key": "bisect", "value": "/*bisect from fake bisect module*/"}]})}, {"key": "math", "value": __get__(dict, "__call__")([], {"js_object": [{"key": "sin", "value": "var sin = Math.sin"}, {"key": "cos", "value": "var cos = Math.cos"}, {"key": "sqrt", "value": "var sqrt = Math.sqrt"}]})}, {"key": "os.path", "value": __get__(dict, "__call__")([], {"js_object": [{"key": "dirname", "value": "function dirname(s) { return s.slice(0, s.lastIndexOf('/')+1)}; var os = {'path':{'dirname':dirname}}"}]})}]});3add2 = function(args, kwargs) {4 if (args instanceof Array && {}.toString.call(kwargs) === '[object Object]' && ( arguments.length ) == 2) {5 /*pass*/6 } else {7 args = Array.prototype.slice.call(arguments);8 kwargs = Object();9 }10 var signature, arguments;11 signature = {"kwargs": Object(), "args": __create_array__("a", "b")};12 arguments = get_arguments(signature, args, kwargs);13 var a = arguments['a'];14 var b = arguments['b'];15 if (( b ) < 0) {16 throw __get__(Exception, "__call__")(["2nd number is negative"], __NULL_OBJECT__);17 } else {18 return (a + b);19 }20}21add2.NAME = "add2";22add2.args_signature = ["a", "b"];23add2.kwargs_signature = { };24add2.types_signature = { };25add2.pythonscript_function = true;26var Foo, __Foo_attrs, __Foo_parents;27__Foo_attrs = Object();28__Foo_parents = [];29__Foo_properties = Object();30__Foo___init__ = function(args, kwargs) {31 if (args instanceof Array && {}.toString.call(kwargs) === '[object Object]' && ( arguments.length ) == 2) {32 /*pass*/33 } else {34 args = Array.prototype.slice.call(arguments);35 kwargs = Object();36 }37 var signature, arguments;38 signature = {"kwargs": Object(), "args": __create_array__("self", "title")};39 arguments = get_arguments(signature, args, kwargs);40 var self = arguments['self'];41 var title = arguments['title'];42 self.title = title;43}44__Foo___init__.NAME = "__Foo___init__";45__Foo___init__.args_signature = ["self", "title"];46__Foo___init__.kwargs_signature = { };47__Foo___init__.types_signature = { };48__Foo___init__.pythonscript_function = true;49__Foo_attrs["__init__"] = __Foo___init__;50__Foo_hello1 = function(args, kwargs) {51 if (args instanceof Array && {}.toString.call(kwargs) === '[object Object]' && ( arguments.length ) == 2) {52 /*pass*/53 } else {54 args = Array.prototype.slice.call(arguments);55 kwargs = Object();56 }57 var signature, arguments;58 signature = {"kwargs": Object(), "args": __create_array__("self", "msg")};59 arguments = get_arguments(signature, args, kwargs);60 var self = arguments['self'];61 var msg = arguments['msg'];62 return __sprintf("%s: %s", [self.title, msg]);63}64__Foo_hello1.NAME = "__Foo_hello1";65__Foo_hello1.args_signature = ["self", "msg"];66__Foo_hello1.kwargs_signature = { };67__Foo_hello1.types_signature = { };68__Foo_hello1.pythonscript_function = true;69__Foo_attrs["hello1"] = __Foo_hello1;70__Foo_hello2 = function(args, kwargs) {71 if (args instanceof Array && {}.toString.call(kwargs) === '[object Object]' && ( arguments.length ) == 2) {72 /*pass*/73 } else {74 args = Array.prototype.slice.call(arguments);75 kwargs = Object();76 }77 var signature, arguments;78 signature = {"kwargs": Object(), "args": __create_array__("self", "msg")};79 arguments = get_arguments(signature, args, kwargs);80 var self = arguments['self'];81 var msg = arguments['msg'];82 return __get__(__get__("{}: {}", "format"), "__call__")([self.title, msg], __NULL_OBJECT__);83}84__Foo_hello2.NAME = "__Foo_hello2";85__Foo_hello2.args_signature = ["self", "msg"];86__Foo_hello2.kwargs_signature = { };87__Foo_hello2.types_signature = { };88__Foo_hello2.pythonscript_function = true;89__Foo_attrs["hello2"] = __Foo_hello2;90Foo = create_class("Foo", __Foo_parents, __Foo_attrs, __Foo_properties);91main = function(args, kwargs) {92 var res, foo, m;93 __get__(__get__(console, "log"), "__call__")(["Sum: ", add2([2, 3], __NULL_OBJECT__)], __NULL_OBJECT__);94 __get__(__get__(console, "log"), "__call__")([__get__(range, "__call__")([5], __NULL_OBJECT__)], __NULL_OBJECT__);95 var __comprehension0;96 __comprehension0 = [];97 var idx0;98 var iter0;99 var get0;100 idx0 = 0;101 iter0 = 10;102 while(( idx0 ) < iter0) {103 var x;104 x = idx0;105 __comprehension0.push((3 * x));106 idx0 += 1;107 }108 __get__(__get__(console, "log"), "__call__")([__comprehension0], __NULL_OBJECT__);109 foo = __get__(Foo, "__call__")(["Meister Eder"], __NULL_OBJECT__);110 try {111m = __get__(__get__(foo, "hello1"), "__call__")(["Pumuckel"], __NULL_OBJECT__);112__get__(__get__(console, "log"), "__call__")([m], __NULL_OBJECT__);113 } catch(__exception__) {114if (__exception__ == Exception || isinstance([__exception__, Exception], Object())) {115var e = __exception__;116__get__(__get__(console, "log"), "__call__")([__get__(str, "__call__")([e], __NULL_OBJECT__)], __NULL_OBJECT__);117}118}119 try {120m = __get__(__get__(foo, "hello2"), "__call__")(["Pumuckel"], __NULL_OBJECT__);121__get__(__get__(console, "log"), "__call__")([m], __NULL_OBJECT__);122 } catch(__exception__) {123if (__exception__ == Exception || isinstance([__exception__, Exception], Object())) {124var e = __exception__;125__get__(__get__(console, "log"), "__call__")([__get__(str, "__call__")([e], __NULL_OBJECT__)], __NULL_OBJECT__);126}127}128 try {129res = add2([2, -1], __NULL_OBJECT__);130__get__(__get__(console, "log"), "__call__")([res], __NULL_OBJECT__);131 } catch(__exception__) {132if (__exception__ == Exception || isinstance([__exception__, Exception], Object())) {133var e = __exception__;134__get__(__get__(console, "log"), "__call__")([__get__(str, "__call__")([e], __NULL_OBJECT__)], __NULL_OBJECT__);135}136}137}138main.NAME = "main";139main.args_signature = [];140main.kwargs_signature = { };141main.types_signature = { };...

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