How to use _dict_err method in assertpy

Best Python code snippet using assertpy_python

pypurepaint.py

Source:pypurepaint.py Github

copy

Full Screen

...169 , PureResponseClient.BEAN_CLASSES.CONTEXT170 )171 return self._dict_ok(self.api_context)172 elif self._result_exception(auth, PureResponseClient.EXCEPTIONS.VALIDATION):173 return self._dict_err(PureResponseClient.ERRORS.AUTH_PARAMS, auth)174 else:175 return self._dict_err(PureResponseClient.ERRORS.AUTH_PROCESS, auth)176 177 def api_invalidate(self):178 self.api_make_request(179 PureResponseClient.BEAN_TYPES.FACADE180 , PureResponseClient.BEAN_CLASSES.CONTEXT181 , PureResponseClient.BEAN_PROCESSES.INVALIDATE182 , no_response = True183 )184 self.api_context = None185 self.api_password = ''186 self.api_username = ''187 188 def api_send_to_list(self, list_name, message_name, scheduling_delay = {189 VALUES.SCHEDULING_UNIT : VALUES.SCHEDULING_DELAY}):190 """191 Bulk send for email campaign to a contact list.192 ----------------------------------------------193 @param list_name - name of a contact list in the system.194 @param message_name - name of an email in the system.195 @param scheduling_delay - [optional] define how long the system 196 should wait before sending the campaign, 197 defaults to 3 minutes.198 """199 create = self.api_make_request(200 PureResponseClient.BEAN_TYPES.FACADE201 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_DELIVERY202 , PureResponseClient.BEAN_PROCESSES.CREATE203 )204 if self._result_success(create):205 delivery_input = {206 PureResponseClient.FIELDS.BEAN_ID : self._get_bean_id(207 create208 , PureResponseClient.BEAN_TYPES.ENTITY209 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_DELIVERY210 )211 }212 search_response = self.api_make_request(213 PureResponseClient.BEAN_TYPES.FACADE214 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_LIST215 , PureResponseClient.BEAN_PROCESSES.SEARCH216 , {PureResponseClient.FIELDS.LIST_NAME : list_name}217 )218 if self._result_success(search_response):219 found = self._get_found_data(220 search_response221 , PureResponseClient.BEAN_TYPES.SEARCH222 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_LIST223 )224 if len(found) is not 0:225 loaded = False226 for key in found:227 entity_data = found[key]228 load_response = self.api_make_request(229 PureResponseClient.BEAN_TYPES.FACADE230 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_LIST231 , PureResponseClient.BEAN_PROCESSES.LOAD232 , entity_data233 )234 235 if not self._result_success(load_response):236 continue237 238 load_output = self._response_data(239 load_response240 , PureResponseClient.BEAN_TYPES.ENTITY241 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_LIST242 )243 244 loaded_name = load_output.get(245 PureResponseClient.FIELDS.LIST_NAME246 )247 248 if (unicode(loaded_name) == unicode(list_name)):249 delivery_input[PureResponseClient.FIELDS.LIST_IDS] = {250 PureResponseClient.FIELDS.FIRST_INDEX : found[251 PureResponseClient.FIELDS.FIRST_INDEX252 ].get(PureResponseClient.FIELDS.LIST_ID)253 }254 loaded = True255 if loaded is False:256 return self._dict_err(257 PureResponseClient.ERRORS.LIST_NOT_FOUND258 , self._response_data(search_response)259 )260 else:261 return self._dict_err(262 PureResponseClient.ERRORS.LIST_NOT_FOUND263 , self._response_data(search_response)264 )265 else:266 return self._dict_err(267 PureResponseClient.ERRORS.GENERIC268 , self._response_data(search_response)269 )270 271 search_response = self.api_make_request(272 PureResponseClient.BEAN_TYPES.FACADE273 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_EMAIL274 , PureResponseClient.BEAN_PROCESSES.SEARCH275 , {PureResponseClient.FIELDS.MESSAGE_NAME : message_name}276 )277 278 if self._result_success(search_response):279 found = self._get_found_data(280 search_response281 , PureResponseClient.BEAN_TYPES.SEARCH282 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_EMAIL283 )284 if len(found) is not 0:285 loaded = False286 for key in found:287 entity_data = found[key]288 load_response = self.api_make_request(289 PureResponseClient.BEAN_TYPES.FACADE290 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_EMAIL291 , PureResponseClient.BEAN_PROCESSES.LOAD292 , entity_data293 )294 295 if not self._result_success(load_response):296 continue297 298 load_output = self._response_data(299 load_response300 , PureResponseClient.BEAN_TYPES.ENTITY301 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_EMAIL302 )303 304 loaded_name = load_output.get(305 PureResponseClient.FIELDS.MESSAGE_NAME306 )307 308 if (unicode(loaded_name) == unicode(message_name)):309 delivery_input[310 PureResponseClient.FIELDS.MESSAGE_ID311 ] = found[312 PureResponseClient.FIELDS.FIRST_INDEX313 ].get(PureResponseClient.FIELDS.MESSAGE_ID)314 loaded = True315 if loaded is False:316 return self._dict_err(317 PureResponseClient.ERRORS.MESSAGE_NOT_FOUND318 , self._response_data(search_response)319 )320 else:321 return self._dict_err(322 PureResponseClient.ERRORS.MESSAGE_NOT_FOUND323 , self._response_data(search_response)324 )325 else:326 return self._dict_err(327 PureResponseClient.ERRORS.GENERIC328 , self._response_data(search_response)329 )330 schedule_time = datetime.datetime.now() + datetime.timedelta(**scheduling_delay)331 schedule_time = schedule_time.strftime('%d/%m/%Y %H:%M')332 delivery_input[PureResponseClient.FIELDS.DELIVERY_TIME] = schedule_time333 334 response = self.api_make_request(335 PureResponseClient.BEAN_TYPES.FACADE336 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_DELIVERY337 , PureResponseClient.BEAN_PROCESSES.STORE338 , delivery_input339 )340 341 if self._result_success(response):342 return self._dict_ok(PureResponseClient.VALUES.SUCCESS)343 else:344 return self._dict_err(345 PureResponseClient.ERRORS.COULD_NOT_DELIVER346 , self._response_data(response)347 )348 elif self._get_result(create) is PureResponseClient.ERRORS.NOT_AUTHENTICATED:349 return create350 else:351 return self._dict_err(352 PureResponseClient.ERRORS.GENERIC353 , self._response_data(create)354 )355 356 def api_send_to_contact(self, email_to, message_name, custom_data = None):357 """358 Send one to one email message.359 ----------------------------------------------360 @param email_to - email address of intended recipient361 @param message_name - name of email message in the system362 @param custom_data - any desired merge tags, should match 363 fully with ones defined in the email 364 unless default values are available 365 in the contact list366 """367 process_data = {PureResponseClient.FIELDS.MSG_MSG_NAME : message_name}368 entity_data = {PureResponseClient.FIELDS.TO_ADDRESS : email_to}369 if custom_data is not None:370 entity_data[PureResponseClient.FIELDS.CUSTOM_DATA] = custom_data371 372 create = self.api_make_request(373 PureResponseClient.BEAN_TYPES.FACADE374 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_ONE_TO_ONE375 , PureResponseClient.BEAN_PROCESSES.CREATE376 , entity_data377 , process_data378 )379 380 if self._result_success(create):381 entity_data = {382 PureResponseClient.FIELDS.BEAN_ID : self._get_bean_id(383 create384 , PureResponseClient.BEAN_TYPES.ENTITY385 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_ONE_TO_ONE386 )387 }388 389 response = self.api_make_request(390 PureResponseClient.BEAN_TYPES.FACADE391 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_ONE_TO_ONE392 , PureResponseClient.BEAN_PROCESSES.STORE393 , entity_data394 )395 396 if self._result_success(response):397 return self._dict_ok(PureResponseClient.VALUES.SUCCESS)398 else:399 return self._dict_err(400 PureResponseClient.ERRORS.COULD_NOT_DELIVER401 , self._response_data(response)402 )403 elif self._get_result(create) is PureResponseClient.ERRORS.NOT_AUTHENTICATED:404 return create405 else:406 response_data = self._response_data(create)407 if 'new message' in response_data.get(PureResponseClient.FIELDS.CONTENT_TYPE):408 return self._dict_err(409 PureResponseClient.ERRORS.MESSAGE_NOT_FOUND410 , response_data411 )412 return self._dict_err(413 PureResponseClient.ERRORS.GENERIC414 , response_data415 )416 def api_create_email(self, message_name, subject, message_body):417 """418 Create a new email message for one-to-one or bulk 419 campaign sending.420 ----------------------------------------------421 @param message_name - Unique message name.422 @param subject - Desired subject line.423 @param message_body - Message content, html enabled.424 """425 search_response = self.api_make_request(426 PureResponseClient.BEAN_TYPES.FACADE427 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_EMAIL428 , PureResponseClient.BEAN_PROCESSES.SEARCH429 , {PureResponseClient.FIELDS.MESSAGE_NAME : message_name}430 )431 if self._result_success(search_response):432 found = self._get_found_data(433 search_response434 , PureResponseClient.BEAN_TYPES.SEARCH435 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_EMAIL436 )437 438 for key in found:439 entity_data = found[key]440 load_response = self.api_make_request(441 PureResponseClient.BEAN_TYPES.FACADE442 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_EMAIL443 , PureResponseClient.BEAN_PROCESSES.LOAD444 , entity_data445 )446 447 if not self._result_success(load_response):448 continue449 450 load_output = self._response_data(451 load_response452 , PureResponseClient.BEAN_TYPES.ENTITY453 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_EMAIL454 )455 456 loaded_name = load_output.get(457 PureResponseClient.FIELDS.MESSAGE_NAME458 )459 if (unicode(loaded_name) == unicode(message_name)):460 return self._dict_err(461 PureResponseClient.ERRORS.MESSAGE_NAME_EXISTS462 )463 464 create_response = self.api_make_request(465 PureResponseClient.BEAN_TYPES.FACADE466 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_EMAIL467 , PureResponseClient.BEAN_PROCESSES.CREATE468 )469 470 if self._result_success(create_response):471 entity_data = {472 PureResponseClient.FIELDS.MESSAGE_NAME : message_name473 , PureResponseClient.FIELDS.SUBJECT : subject474 , PureResponseClient.FIELDS.BODY_HTML : message_body475 , PureResponseClient.FIELDS.BEAN_ID : self._get_bean_id(476 create_response477 , PureResponseClient.BEAN_TYPES.ENTITY478 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_EMAIL479 )480 }481 482 response = self.api_make_request(483 PureResponseClient.BEAN_TYPES.FACADE484 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_EMAIL485 , PureResponseClient.BEAN_PROCESSES.STORE486 , entity_data487 )488 489 if self._result_success(response):490 return self._dict_ok(PureResponseClient.VALUES.SUCCESS)491 else:492 return self._dict_err(493 PureResponseClient.ERRORS.MESSAGE_NOT_SAVED494 , self._response_data(response)495 )496 else:497 return self._dict_err(498 PureResponseClient.ERRORS.BEAN_NOT_CREATED499 , self._response_data(create_response)500 )501 502 def api_create_contact_list(self, list_name, list_data503 , notify_uri = None, overwrite_existing = False):504 """505 Create a new contact list.506 Uses internal helpers to achieve this in accordance 507 with supplied arguments.508 ----------------------------------------------509 @param list_name - name of the contact list510 @param list_data - list of dictionaries of records511 to be entered into the list as 512 initial data. Must be non-empty.513 @param notify_uri - Uri which recieves notifications 514 when changes are made to the list.515 e.g. blackhole@example.none516 @param overwrite_existing - Boolean describing the action to 517 be taken if a list by the given name 518 already exists.519 """520 search_response = self.api_make_request(521 PureResponseClient.BEAN_TYPES.FACADE522 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_LIST523 , PureResponseClient.BEAN_PROCESSES.SEARCH524 , {PureResponseClient.FIELDS.LIST_NAME : list_name}525 )526 if self._result_success(search_response):527 found = self._get_found_data(528 search_response529 , PureResponseClient.BEAN_TYPES.SEARCH530 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_LIST531 )532 if len(found) is 0:533 return self._api_new_contact_list_helper(list_name, list_data, notify_uri)534 elif overwrite_existing:535 remove_response = self._api_remove_contact_list_helper(list_name, found)536 if self._result_success(remove_response):537 return self._api_new_contact_list_helper(list_name, list_data, notify_uri)538 else:539 return remove_response540 else:541 return self._dict_err(542 PureResponseClient.ERRORS.LIST_NAME_EXISTS543 , self._response_data(search_response)544 )545 elif self._get_result(search_response) is PureResponseClient.ERRORS.NOT_AUTHENTICATED:546 return search_response547 else:548 return self._dict_err(549 PureResponseClient.ERRORS.GENERIC550 , self._response_data(search_response)551 )552 553 def _api_new_contact_list_helper(self, list_name, list_data, notify_uri):554 """555 Internal use.556 Re-usable helper which does the actual creation of the 557 new list.558 ----------------------------------------------559 @param list_name - name of the contact list560 @param list_data - list of dictionaries of records561 to be entered into the list as 562 initial data. Must be non-empty.563 @param notify_uri - Uri which recieves notifications 564 when changes are made to the list.565 e.g. blackhole@example.none566 """567 create = self.api_make_request(568 PureResponseClient.BEAN_TYPES.FACADE569 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_LIST570 , PureResponseClient.BEAN_PROCESSES.CREATE571 )572 if self._result_success(create):573 entity_data = {574 PureResponseClient.FIELDS.UPLOAD_NOTIFY_URI : notify_uri575 , PureResponseClient.FIELDS.LIST_NAME : list_name576 , PureResponseClient.FIELDS.BEAN_ID : self._get_bean_id(577 create578 , PureResponseClient.BEAN_TYPES.ENTITY579 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_LIST580 )581 }582 583 paste_file = self._dictlist_to_csv(list_data)584 entity_data[585 PureResponseClient.FIELDS.PASTE_FILE586 + PureResponseClient.FIELDS.BASE64_PARTIAL587 ] = base64.b64encode(paste_file)588 589 entity_data = dict(590 entity_data591 , **self._build_contact_entity(592 paste_file593 )594 )595 response = self.api_make_request(596 PureResponseClient.BEAN_TYPES.FACADE597 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_LIST598 , PureResponseClient.BEAN_PROCESSES.STORE599 , entity_data600 )601 if self._result_success(response):602 return self._dict_ok(PureResponseClient.VALUES.SUCCESS)603 else:604 return self._dict_err(605 PureResponseClient.ERRORS.LIST_NOT_SAVED606 , self._response_data(response)607 )608 return self._dict_err(609 PureResponseClient.ERRORS.BEAN_NOT_CREATED610 , self._response_data(search_response)611 )612 613 def _api_remove_contact_list_helper(self, list_name, found):614 """615 Remove existing list by same name.616 From a list of found beans, load them and compare their 617 names to the supplied list_name. If the names are the 618 same make a call to remove the existing bean.619 ----------------------------------------------620 @param list_name - Name of the list to overwrite621 @param found - Set of lists where list_name was a 622 (potentially improper) subset of the 623 name of the list. If equal (improper) 624 this list will be removed.625 """626 for key in found:627 entity_data = found[key]628 load_response = self.api_make_request(629 PureResponseClient.BEAN_TYPES.FACADE630 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_LIST631 , PureResponseClient.BEAN_PROCESSES.LOAD632 , entity_data633 )634 635 if not self._result_success(load_response):636 continue637 638 load_output = self._response_data(639 load_response640 , PureResponseClient.BEAN_TYPES.ENTITY641 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_LIST642 )643 644 loaded_name = load_output.get(645 PureResponseClient.FIELDS.LIST_NAME646 )647 if (unicode(loaded_name) == unicode(list_name)):648 entity_data = {649 PureResponseClient.FIELDS.BEAN_ID : load_output[650 PureResponseClient.FIELDS.BEAN_ID651 ]652 }653 654 return self.api_make_request(655 PureResponseClient.BEAN_TYPES.FACADE656 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_LIST657 , PureResponseClient.BEAN_PROCESSES.REMOVE658 , entity_data659 )660 return self._dict_err(661 PureResponseClient.ERRORS.LIST_NOT_FOUND662 , found663 )664 665 def _api_append_contact_list(self, entity_data, notify_uri):666 """667 Internal use.668 Abstraction layer between built entity data 669 (self._api_add_contact_ambiguous) and sending 670 request (self.api_make_request).671 ----------------------------------------------672 @param entity_data - information about the contacts 673 to append as well as general query 674 information675 """676 create = self.api_make_request(677 PureResponseClient.BEAN_TYPES.FACADE678 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_LIST679 , PureResponseClient.BEAN_PROCESSES.CREATE680 )681 if self._result_success(create):682 entity_data[PureResponseClient.FIELDS.BEAN_ID] = self._get_bean_id(683 create684 , PureResponseClient.BEAN_TYPES.ENTITY685 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_LIST686 )687 entity_data[PureResponseClient.FIELDS.UPLOAD_NOTIFY_URI] = notify_uri688 response = self.api_make_request(689 PureResponseClient.BEAN_TYPES.FACADE690 , PureResponseClient.BEAN_CLASSES.CAMPAIGN_LIST691 , PureResponseClient.BEAN_PROCESSES.STORE692 , entity_data693 )694 695 if self._result_success(response):696 return self._dict_ok(PureResponseClient.VALUES.SUCCESS)697 else:698 return self._dict_err(699 PureResponseClient.ERRORS.LIST_NOT_SAVED700 , self._response_data(response)701 )702 elif self._get_result(create) is PureResponseClient.ERRORS.NOT_AUTHENTICATED:703 return create704 else:705 return self._dict_err(706 PureResponseClient.ERRORS.GENERIC707 , self._response_data(create)708 )709 710 def _api_add_contact_ambiguous(self, list_name, contact_data, notify_uri):711 """712 Internal use.713 Abstraction layer between publically exposed functions 714 (self.api_add_contact, self.api_add_contacts) and request 715 handling (self._api_append_contact_list).716 ----------------------------------------------717 @param list_name - name of contact list to append to.718 @param contact_data - dictionary or list of dictionaries 719 containing contact data to append.720 """721 entity_data = {722 PureResponseClient.FIELDS.LIST_NAME : list_name723 , PureResponseClient.FIELDS.UPLOAD_TYPE : PureResponseClient.VALUES.APPEND724 }725 if isinstance(contact_data, list):726 paste_file = self._dictlist_to_csv(contact_data)727 else:728 paste_file = self._dict_to_csv(contact_data)729 730 entity_data[731 PureResponseClient.FIELDS.PASTE_FILE732 + PureResponseClient.FIELDS.BASE64_PARTIAL733 ] = base64.b64encode(paste_file)734 entity_data = dict(735 entity_data736 , **self._build_contact_entity(paste_file)737 )738 return self._api_append_contact_list(entity_data, notify_uri)739 740 def api_add_contact(self, list_name, contact, notify_uri = None):741 """742 Add single contact to a given contact list.743 Alias for _api_add_contact_ambiguous.744 ----------------------------------------------745 @param list_name - name of contact list to append to746 @param contact - dictionary of contact data747 """748 return self._api_add_contact_ambiguous(list_name, contact, notify_uri)749 750 def api_add_contacts(self, list_name, contacts, notify_uri = None):751 """752 Add multiple contacts to a given contact list.753 Alias for _api_add_contact_ambiguous.754 The contacts parameter should be a list of dictionaries. 755 The dictionaries do not require matching key sets as a 756 master-list of keys is generated in the process of 757 producing a csv to upload.758 ----------------------------------------------759 @param list_name - name of contact list to append to760 @param contacts - list of dictionaries761 """762 return self._api_add_contact_ambiguous(list_name, contacts, notify_uri)763 764 def api_make_request(self, bean_type, bean_class, bean_process765 , entity_data = None, process_data = None, no_response = False):766 if self.api_context or (bean_process is PureResponseClient.BEAN_PROCESSES.AUTHENTICATE):767 api_context = self.api_context or suds.null()768 response = self.api_client.service.handleRequest(769 api_context770 , bean_type + '_' + bean_class771 , bean_process772 , self._dict_to_ptarr(entity_data)773 , self._dict_to_ptarr(process_data)774 )775 if no_response:776 return True777 else:778 return self._ptarr_to_dict(response)779 else:780 return self._dict_err(781 PureResponseClient.ERRORS.NOT_AUTHENTICATED782 , None783 )784 785 def _response_data(self, response_dict, bean_type = None786 , bean_class = None, field = FIELDS.RESULT_DATA):787 if (bean_type is not None) and (bean_class is not None):788 return response_dict[field][bean_type + '_' + bean_class]789 elif (bean_type is not None) or (bean_class is not None):790 raise Exception(PureResponseClient.ERRORS.INVALID_PARAMS)791 else:792 return response_dict[field]793 794 def _get_result(self, response):795 return self._response_data(response, field=PureResponseClient.FIELDS.RESULT)796 797 def _result_success(self, response):798 return self._get_result(response) == PureResponseClient.VALUES.SUCCESS799 800 def _get_bean_id(self, response, bean_type, bean_class):801 return self._response_data(802 response803 , bean_type804 , bean_class805 ).get(PureResponseClient.FIELDS.BEAN_ID)806 807 def _get_found_data(self, response, bean_type, bean_class):808 return self._response_data(809 response810 , bean_type811 , bean_class812 ).get(PureResponseClient.FIELDS.FOUND_DATA)813 814 def _result_exception(self, response, exception):815 return self._get_result(response) is exception816 817 def _dict_ok(self, result = VALUES.SUCCESS):818 return {'ok' : True, 'result': result}819 820 def _dict_err(self, error = ERRORS.GENERIC, meta = None):821 return {'ok' : False, 'result' : error, 'meta' : meta}822 823 def _unicode_exceptions(self, key):824 exceptions = [825 PureResponseClient.FIELDS.BEAN_ID826 , PureResponseClient.FIELDS.MESSAGE_ID827 , PureResponseClient.FIELDS.LIST_ID828 ]829 if key.isdigit():830 return True831 else:832 for field in exceptions:833 if key == unicode(field):834 return True...

Full Screen

Full Screen

base.py

Source:base.py Github

copy

Full Screen

...91 """92 if self._check_dict_like(self.val, check_values=False, return_as_bool=True) and \93 self._check_dict_like(other, check_values=False, return_as_bool=True):94 if self._dict_not_equal(self.val, other, ignore=kwargs.get('ignore'), include=kwargs.get('include')):95 self._dict_err(self.val, other, ignore=kwargs.get('ignore'), include=kwargs.get('include'))96 else:97 if self.val != other:98 return self.error('Expected <%s> to be equal to <%s>, but was not.' % (self.val, other))99 return self100 def is_not_equal_to(self, other):101 """Asserts that val is not equal to other.102 Checks actual is not equal to expected using the ``!=`` operator.103 Args:104 other: the expected value105 Examples:106 Usage::107 assert_that(1 + 2).is_not_equal_to(4)108 assert_that('foo').is_not_equal_to('bar')109 assert_that(123).is_not_equal_to(456)...

Full Screen

Full Screen

helpers.py

Source:helpers.py Github

copy

Full Screen

...189 return [i[0] if type(i) is tuple and len(i) == 1 else i for i in (ignore if type(ignore) is list else [ignore])]190 def _dict_include(self, include):191 """Helper to make a list from given include kwarg values."""192 return [i[0] if type(i) is tuple else i for i in (include if type(include) is list else [include])]193 def _dict_err(self, val, other, ignore=None, include=None):194 """Helper to construct error message for dict comparison."""195 def _dict_repr(d, other):196 out = ''197 ellip = False198 for k, v in sorted(d.items()):199 if k not in other:200 out += '%s%s: %s' % (', ' if len(out) > 0 else '', repr(k), repr(v))201 elif v != other[k]:202 out += '%s%s: %s' % (203 ', ' if len(out) > 0 else '',204 repr(k),205 _dict_repr(v, other[k]) if self._check_dict_like(206 v, check_values=False, return_as_bool=True) and self._check_dict_like(207 other[k], check_values=False, return_as_bool=True) else repr(v)...

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