Best Python code snippet using localstack_python
test_music_model_sql_backend.py
Source:test_music_model_sql_backend.py
...11cache = create_cache_here(__file__)12spider = CachedRequest(cache=cache, log_cache_miss=True, expire=24 * 3600)13spider.use_requests()14class TestMusicPage(object):15 def test_parse_response(self):16 music_id = 2017 music = MusicPage(id=music_id)18 url = music.build_url()19 html = spider.request_for_html(url)20 pres = music.parse_response(url, request=None, response=None, html=html)21 assert pres.entity_data["title"] == "Music {} Title".format(music_id)22 assert len(pres.children) == (max_n_artist + max_n_genre)23class TestArtistPage(object):24 def test_parse_response(self):25 artist_id = 526 artist_page = ArtistPage(id=artist_id)27 url = artist_page.build_url()28 html = spider.request_for_html(url)29 pres = artist_page.parse_response(url, request=None, response=None, html=html)30 assert len(pres.entity_data["musics"]) > 031 assert len(pres.entity_data["musics"]) == len(pres.children)32class TestGenrePage(object):33 def test_parse_response(self):34 genre_id = 535 genre_page = GenrePage(id=genre_id)36 url = genre_page.build_url()37 html = spider.request_for_html(url)38 pres = genre_page.parse_response(url, request=None, response=None, html=html)39 assert len(pres.entity_data["musics"]) > 040 assert len(pres.entity_data["musics"]) == len(pres.children)41class TestHomePage(object):42 def test_parse_response(self):43 rand_music_page = RandomMusicPage()44 url = rand_music_page.build_url()45 html = spider.request_for_html(url)46 pres = rand_music_page.parse_response(url, request=None, response=None, html=html)47 assert len(pres.entity_data["musics"]) == n_random_music48 assert len(pres.entity_data["musics"]) == len(pres.children)49if __name__ == "__main__":50 import os51 basename = os.path.basename(__file__)...
test_movie_model_sql_backend.py
Source:test_movie_model_sql_backend.py
...9cache = create_cache_here(__file__)10spider = CachedRequest(cache=cache, log_cache_miss=True, expire=24 * 3600)11spider.use_requests()12class TestMovieCoverImagePage(object):13 def test_parse_response(self):14 movie_id = 2515 movie_cover_image = MovieCoverImagePage(id=movie_id)16 url = movie_cover_image.build_url()17 html = spider.request_for_html(url)18 pres = movie_cover_image.parse_response(url, request=None, response=None, html=html)19 assert "<div" in pres.entity_data["image_content"]20 assert len(pres.children) == 021class TestMoviePage(object):22 def test_parse_response(self):23 movie_id = 2524 movie = MoviePage(id=movie_id)25 url = movie.build_url()26 html = spider.request_for_html(url)27 pres = movie.parse_response(url, request=None, response=None, html=html)28 assert pres.entity_data["title"] == "Movie {} Title".format(movie_id)29 assert len(pres.children) == 030class TestListPage(object):31 def test_parse_response(self):32 page_num = 333 listpage = ListPage(id=page_num)34 url = listpage.build_url()35 html = spider.request_for_html(url)36 pres = listpage.parse_response(url, request=None, response=None, html=html)37 assert len(pres.children) == n_movie_each_page38class TestHomePage(object):39 def test_parse_response(self):40 homepage = HomePage()41 url = homepage.build_url()42 html = spider.request_for_html(url)43 pres = homepage.parse_response(url, request=None, response=None, html=html)44 assert pres.entity_data["max_page_num"] == max_page_id45 assert len(pres.children) == max_page_id46 assert pres.children[-1].id == max_page_id47if __name__ == "__main__":48 import os49 basename = os.path.basename(__file__)...
test_crossref.py
Source:test_crossref.py
...15 response['message']['title'][0] ==16 'RETRACTED: Plasma equilibrium reconstruction for the nuclear ' +17 'fusion of magnetically confined hydrogen isotopes'18 )19 def test_parse_response(self):20 logging.getLogger('bibliom.pytsest').debug('-->TestCrossref.test_parse_response')21 response = cr_works(ids='10.1016/j.ijhydene.2016.06.178')22 paper = parse_response(response)23 assert isinstance(paper, Paper)24 assert(25 paper.title ==26 'RETRACTED: Plasma equilibrium reconstruction for the nuclear ' +27 'fusion of magnetically confined hydrogen isotopes'...
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!!