Best Python code snippet using stestr_python
test_xigtpath.py
Source:test_xigtpath.py
...82 def test_text(self):83 assert xp.find(xc1, '//item/text()') == 'inu=ga san-biki hoe-ru'84 def test_value(self):85 assert xp.find(xc3, '//tier[@type="words"]/item/value()') == 'inu=ga'86 def test_find_metadata(self):87 assert xp.find(xc1m, 'igt/metadata') == xc1m[0].metadata[0]88 assert xp.findall(xc1m, 'igt/metadata') == [xc1m[0].metadata[0]]89 assert xp.find(xc1m, 'igt/metadata/meta') == xc1m[0].metadata[0][0]90 assert xp.findall(xc1m, 'igt/metadata/meta') == [xc1m[0].metadata[0][0]]91 assert xp.find(xc1m, 'igt/metadata/meta/*') == xc1m[0].metadata[0][0][0]92 assert xp.findall(xc1m, 'igt/metadata/meta/*') == [xc1m[0].metadata[0][0][0], xc1m[0].metadata[0][0][1]]93 assert xp.find(xc1m, 'igt/metadata/meta/dc:subject') == xc1m[0].metadata[0][0][0]94 assert xp.find(xc1m, 'igt/metadata//dc:subject') == xc1m[0].metadata[0][0][0]95 assert xp.find(xc1m, 'igt/metadata/meta/dc:subject/@olac:code') == 'jpn'96 assert xp.find(xc1m, 'igt/metadata/meta/dc:subject/text()') == 'Japanese'97 assert xp.findall(xc1m, 'igt/metadata/meta/dc:*/@olac:code') == ['jpn', 'eng']98 def test_find_referent(self):99 assert xp.find(xc3, '//tier[@type="words"]/referent()') == xc3[0][0]100 assert xp.find(xc3, '//tier[@type="words"]/referent("alignment")') == None...
test.py
Source:test.py
...21 self.assertTrue('item2' in new_items)22 self.assertTrue('item3' in new_items)23 # The script should ignore the non-directory files24 self.assertTrue('ignore_file' not in new_items)25 def test_find_metadata(self):26 matches = [('item1', 'item1.xml'),27 ('item2', 'item2-dc.xml'),28 ('item3', 'item3_MRC.xml')]29 metadata_dir = os.path.join(self.tmpdir, 'metadata')30 # The script should locate the appropriate metadata file for each item31 # The test directory also contains bogus files to test against such as32 # 'item10.xml'33 for pair in matches:34 meta_path = baggins.find_metadata(pair[0], metadata_dir)35 meta_name = os.path.split(meta_path)[1]36 self.assertTrue(meta_name == pair[1])37 def test_build_foundation(self):38 item_path = os.path.join(self.tmpdir, 'new_items', 'item1')39 meta_path = os.path.join(self.tmpdir, 'metadata', 'item1.xml')...
test_parser.py
Source:test_parser.py
...7 def test_find_content(self):8 self.assertEqual(8398, len(subject.find_content(FILE)))9 def test_links(self):10 self.assertEqual(16, len(subject.find_unique_article_links(FILE)))11 def test_find_metadata(self):12 url = 'https://www.ft.com/content/afc67ffb-3f4c-4b41-8240-1a96115325c9'13 headline = 'Itâs not pent up demand, itâs savings'14 standfirst = 'Also, why did Jamie Dimon get a random $50m?'15 date_published = '2021-07-22T05:30:07.739Z'16 author = 'Robert Armstrong'17 category = 'Markets'18 result = subject.find_metadata(FILE)19 self.assertEqual(url, result.get_url())20 self.assertEqual(headline, result.get_headline())21 self.assertEqual(standfirst, result.get_standfirst())22 self.assertEqual(date_published, result.get_date_published())23 self.assertEqual(author, result.get_author())24 self.assertEqual(category, result.get_category())25 ...
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!!