Best Python code snippet using localstack_python
test_signature.py
Source:test_signature.py
...28 page = SignaturePage(top_login)29 page.goto("https://top.tezign.com/#/app/businessDetail")30 selector = SignaturePage.selectors["exception_reminder_assert"]31 page.exception_reminder()32 assert page._text_content(selector) == 'å
±1454个ç¾åä¸å¡æ»é¢ï¼154,374,115.60ç¾åæ»é¢ï¼154,374,115.60'33 # ç¹å»ç¾åå±å¼é项å
³è项ç®ç¶æ34 def test_associated_item_status(self, top_login):35 page = SignaturePage(top_login)36 page.goto("https://top.tezign.com/#/app/businessDetail")37 selector = SignaturePage.selectors["associated_item_not_associated_assert"]38 page.associated_item_status()39 assert page._text_content(selector) == 'å
±2639个ç¾åä¸å¡æ»é¢ï¼144,433,226.42ç¾åæ»é¢ï¼127,983,435.42'40 # ç¹å»ç¾åå±å¼é项ç¾ååè¯å®¡æ ¸41 def test_signing_voucher_approval(self, top_login):42 page = SignaturePage(top_login)43 page.goto("https://top.tezign.com/#/app/businessDetail")44 selector = SignaturePage.selectors["signing_voucher_approval_assert"]45 page.signing_voucher_approval()46 assert page._text_content(selector) == 'å
±4278个ç¾åä¸å¡æ»é¢ï¼336,380,244.38ç¾åæ»é¢ï¼319,930,453.38'47 # ç¹å»ç¾åå±å¼é项ï¼äº¤ä»ç¶æ48 def test_delivery_status(self, top_login):49 page = SignaturePage(top_login)50 page.goto("https://top.tezign.com/#/app/businessDetail")51 selector = SignaturePage.selectors["delivery_status_assert"]52 page.delivery_status()53 assert page._text_content(selector) == 'å
±197个ç¾åä¸å¡æ»é¢ï¼29,668,534.24ç¾åæ»é¢ï¼29,608,534.24'54 # ç¹å»ç¾åå±å¼é项ï¼å¼ç¥¨ç¶æ55 def test_invoicing_status(self, top_login):56 page = SignaturePage(top_login)57 page.goto("https://top.tezign.com/#/app/businessDetail")58 selector = SignaturePage.selectors["invoicing_status_assert"]59 page.invoicing_status()60 assert page._text_content(selector) == 'å
±2944个ç¾åä¸å¡æ»é¢ï¼195,551,850.30ç¾åæ»é¢ï¼179,122,059.30'61 # ç¹å»ç¾åå±å¼é项ï¼åææ¹ç»æ¬¾ç¶æ62 def test_payment_status(self, top_login):63 page = SignaturePage(top_login)64 page.goto("https://top.tezign.com/#/app/businessDetail")65 selector = SignaturePage.selectors["payment_status_assert"]66 page.payment_status()67 assert page._text_content(selector) == 'å
±3047个ç¾åä¸å¡æ»é¢ï¼193,746,530.26ç¾åæ»é¢ï¼177,296,739.26'68 # ç¹å»ç¾åå±å¼é项ï¼æ¶æ¬¾ç¶æ69 def test_collection_status(self, top_login):70 page = SignaturePage(top_login)71 page.goto("https://top.tezign.com/#/app/businessDetail")72 selector = SignaturePage.selectors["collection_status_assert"]73 page.collection_status()74 assert page._text_content(selector) == 'å
±2998个ç¾åä¸å¡æ»é¢ï¼193,183,291.66ç¾åæ»é¢ï¼176,733,500.66'75 # ç¹å»ç¾åå±å¼é项ï¼å
³èæ¡ä¾76 def test_related_cases(self, top_login):77 page = SignaturePage(top_login)78 page.goto("https://top.tezign.com/#/app/businessDetail")79 selector = SignaturePage.selectors["related_cases_assert"]80 page.related_cases()81 assert page._text_content(selector) == 'å
±425个ç¾åä¸å¡æ»é¢ï¼73,812,172.95ç¾åæ»é¢ï¼73,803,932.95'82 # ç¹å»ç¾åå±å¼é项ï¼æ ¡åç¶æ83 def test_calibration_status(self, top_login):84 page = SignaturePage(top_login)85 page.goto("https://top.tezign.com/#/app/businessDetail")86 selector = SignaturePage.selectors["calibration_status_assert"]87 page.calibration_status()88 assert page._text_content(selector) == 'å
±4277个ç¾åä¸å¡æ»é¢ï¼336,367,524.38ç¾åæ»é¢ï¼319,917,733.38'89 # ç¹å»ç¾åå±å¼é项ï¼æ¶å
¥éé¢åæ´æ¶é´90 def test_change_time_of_revenue_amount(self, top_login):91 page = SignaturePage(top_login)92 page.goto("https://top.tezign.com/#/app/businessDetail")93 selector = SignaturePage.selectors["change_time_of_revenue_amount_assert"]94 page.change_time_of_revenue_amount()95 # assert page._text_content(selector) == 'å
±1个ç¾åä¸å¡æ»é¢ï¼12,000.00ç¾åæ»é¢ï¼12,000.00'96 # ç¹å»æ¥æºæç´¢97 def test_source(self, top_login):98 page = SignaturePage(top_login)99 page.goto("https://top.tezign.com/#/app/businessDetail")100 selector = SignaturePage.selectors["source_assert"]101 page.source()102 assert page._text_content(selector) == 'å
±113个ç¾åä¸å¡æ»é¢ï¼14,204,025.39ç¾åæ»é¢ï¼14,204,025.39'103 # ç¹å»å®¢æ·ãé¨é¨æç´¢104 def test_customer_department(self, top_login):105 page = SignaturePage(top_login)106 page.goto("https://top.tezign.com/#/app/businessDetail")107 selector = SignaturePage.selectors["customer_department_assert"]108 page.customer_department()109 assert page._text_content(selector) == 'å
±1个ç¾åä¸å¡æ»é¢ï¼151,000.00ç¾åæ»é¢ï¼151,000.00'110 # éæ©å¼ç¥¨æ¶é´111 def test_invoicing_time(self, top_login):112 page = SignaturePage(top_login)113 page.goto("https://top.tezign.com/#/app/businessDetail")114 selector = SignaturePage.selectors["invoicing_time_assert"]115 page.invoicing_time()116 assert page._text_content(selector) == 'å
±0个ç¾åä¸å¡æ»é¢ï¼0.00ç¾åæ»é¢ï¼0.00'117 # ç¾åæ¶é´118 def test_signature_time(self, top_login):119 page = SignaturePage(top_login)120 page.goto("https://top.tezign.com/#/app/businessDetail")121 selector = SignaturePage.selectors["change_time_of_revenue_amount_assert"]122 page.change_time_of_revenue_amount()123 # assert page._text_content(selector) == 'å
±0个ç¾åä¸å¡æ»é¢ï¼0.00ç¾åæ»é¢ï¼0.00'124 # ç¾åä¸çº§å®¢æ·125 def test_parent_customer(self, top_login):126 page = SignaturePage(top_login)127 page.goto("https://top.tezign.com/#/app/businessDetail")128 selector = SignaturePage.selectors["parent_customer_assert"]129 page.parent_customer()130 assert page._text_content(selector) == 'å
±3个ç¾åä¸å¡æ»é¢ï¼1,013,721.00ç¾åæ»é¢ï¼1,013,721.00'131 # æ索交ä»æ¶é´132 def test_delivery_time(self, top_login):133 page = SignaturePage(top_login)134 page.goto("https://top.tezign.com/#/app/businessDetail")135 selector = SignaturePage.selectors["change_time_of_revenue_amount_assert"]136 page.delivery_time()137 assert page._text_content(selector) == 'å
±1个ç¾åä¸å¡æ»é¢ï¼12,000.00ç¾åæ»é¢ï¼12,000.00'138 # æç´¢ä¸å¡ç±»å139 def test_business_type(self, top_login):140 page = SignaturePage(top_login)141 page.goto("https://top.tezign.com/#/app/businessDetail")142 selector = SignaturePage.selectors["business_type_assert"]143 page.business_type()144 assert page._text_content(selector) == 'å
±1个ç¾åä¸å¡æ»é¢ï¼100.00ç¾åæ»é¢ï¼100.00'145 # æç´¢éå®äººå146 def test_salesman(self, top_login):147 page = SignaturePage(top_login)148 page.goto("https://top.tezign.com/#/app/businessDetail")149 page._wait(1)150 selector = SignaturePage.selectors["business_type_assert"]151 page.salesman()152 assert page._text_content(selector) == 'å
±6个ç¾åä¸å¡æ»é¢ï¼1,038,541.00ç¾åæ»é¢ï¼1,038,541.00'153 # ç¾åå表ï¼æä½154 def test_operation(self, top_login):155 page = SignaturePage(top_login)156 page.goto("https://top.tezign.com/#/app/businessDetail")157 page.operation()158 # ç¹å»ç¾åè¿å
¥è¯¦æ
页é¢159 def test_signature_detail(self, top_login):160 page = SignaturePage(top_login)161 page.goto("https://top.tezign.com/#/app/businessDetail")...
edin-food-health-training-hub.py
Source:edin-food-health-training-hub.py
...4starting_url = 'http://www.foodandhealthtraining.org.uk/directory/?apage=%s'5def _text(node, class_name):6 result = node.find(attrs={'class': class_name})7 return result.text if result else ''8def _text_content(node, class_name):9 """Example:10 [u'The Voice of Carers Across Lothian provides is an organisation ... ',11 <br />,12 u'\r\nVOCAL supports carers in all family or relationship settings, ...']13 """14 return ''.join([tag for tag in node.find(attrs={'class': class_name}).contents if type(tag) is NavigableString])15def _address(node):16 pc = _text_content(vcard, 'street-address').strip().split('\n')[-1]17 return _text_content(vcard, 'street-address'), pc18def _url(node):19 a = node.a20 if a:21 return a.text, a['href']22 else:23 return node.text, ''24for i in range(1, 5):25 print 'page', i26 html = scraperwiki.scrape(starting_url % i)27 soup = BeautifulSoup(html)28 for vcard in soup.findAll('div', attrs={'class': 'vcard'}):29 name = _text(vcard, 'fn org')30 _, url = _url(vcard.find(attrs={'class': 'url'}))31 note = _text_content(vcard, 'note')32 # names not used currently33 # given_name = _text(vcard, 'given-name')34 # family_name = _text(vcard, 'family-name')35 street_address, postcode = _address(vcard)36 tel = _text(vcard, 'tel')37 description = '%s%s%s' % (38 note, 39 ('\n%s' % street_address) if street_address else '',40 ('\n%s' % tel) if tel else ''41 )42 record = { 43 'name': name, 44 'url': url, 45 'description': description, 46 'locations': postcode, 47 'tags': '#efht, food, nutrition',48 'address': street_address,49 'tel': tel 50 }51 scraperwiki.sqlite.save(["name"], record) 52import re53import scraperwiki54from BeautifulSoup import BeautifulSoup, NavigableString55starting_url = 'http://www.foodandhealthtraining.org.uk/directory/?apage=%s'56def _text(node, class_name):57 result = node.find(attrs={'class': class_name})58 return result.text if result else ''59def _text_content(node, class_name):60 """Example:61 [u'The Voice of Carers Across Lothian provides is an organisation ... ',62 <br />,63 u'\r\nVOCAL supports carers in all family or relationship settings, ...']64 """65 return ''.join([tag for tag in node.find(attrs={'class': class_name}).contents if type(tag) is NavigableString])66def _address(node):67 pc = _text_content(vcard, 'street-address').strip().split('\n')[-1]68 return _text_content(vcard, 'street-address'), pc69def _url(node):70 a = node.a71 if a:72 return a.text, a['href']73 else:74 return node.text, ''75for i in range(1, 5):76 print 'page', i77 html = scraperwiki.scrape(starting_url % i)78 soup = BeautifulSoup(html)79 for vcard in soup.findAll('div', attrs={'class': 'vcard'}):80 name = _text(vcard, 'fn org')81 _, url = _url(vcard.find(attrs={'class': 'url'}))82 note = _text_content(vcard, 'note')83 # names not used currently84 # given_name = _text(vcard, 'given-name')85 # family_name = _text(vcard, 'family-name')86 street_address, postcode = _address(vcard)87 tel = _text(vcard, 'tel')88 description = '%s%s%s' % (89 note, 90 ('\n%s' % street_address) if street_address else '',91 ('\n%s' % tel) if tel else ''92 )93 record = { 94 'name': name, 95 'url': url, 96 'description': description, ...
content.py
Source:content.py
1import logging2logger = logging.getLogger('jsuite')3def _text_content(node):4 return " ".join([x.strip() for x in node.itertext() if x.strip() is not ""])5def body_text(etree):6 """ Extracts text content from the body element of a JATS XML ElementTree 7 instance"""8 BODY_XPATH = '/article/body'9 query_set = etree.xpath(BODY_XPATH)10 if len(query_set) is 0:11 logger.warn('No body element found in article.')12 return None13 if len(query_set) is 1:...
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!!