Best Python code snippet using lemoncheesecake
anytime_test.py
Source:anytime_test.py
...36# print 'didnt succeed....'37CONFIGS = [(heuristic_func, ['--search', tmp]) ]38ATTRIBUTES = ['coverage', 'expansions','initial_h_value','cost','hstar_to_h','statistics','commualtive_hstar_to_h']39exp = DownwardExperiment(path=EXPPATH, repo=REPO, environment=ENV, limits={'search_time': 300})40#exp.add_suite({'freecell:pfile5'})41#exp.add_suite({'grid:prob_grid_29982290.pddl','grid:prob_grid_58992290.pddl','grid:prob_grid_0101192290.pddl'})42#exp.add_suite({'grid:prob_grid_29982290.pddl'})43#exp.add_suite({'grid','ferry','logistics'})44#exp.add_suite({'rovers:p01.pddl'})45# exp.add_suite({'blocks:probBLOCKS-8-0.pddl','blocks:probBLOCKS-8-1.pddl','blocks:probBLOCKS-9-0.pddl','blocks:probBLOCKS-9-1.pddl', 'blocks:probBLOCKS-11-1.pddl'})46exp.add_suite({'blocks:probBLOCKS-4-1.pddl'})47# exp.add_suite({'gripper','logistics00','openstacks','pathways','rovers','satellite','trucks'})48# exp.add_suite({'schedule','zenotravel','trucks-strips','sokoban-sat11-strips','philosophers'})49# exp.add_suite({'blocks','tpp','storage',})50# exp.add_suite({'gripper','logistics00','openstacks'})51# exp.add_suite({'rovers','satellite'})52#exp.add_suite({'blocks','storage','tpp'})53#exp.add_suite({'blocks','rovers','satellite','schedule','storage','tpp','trucks'})54#exp.add_suite({'blocks','rovers'})55#exp.add_suite({'storage','tpp','trucks'})56#exp.add_suite({'satellite','schedule'})57#exp.add_suite({'tpp','rovers','storage'})58for nick, config in CONFIGS:59 exp.add_config(nick, config)60# Make a report containing absolute numbers (this is the most common report).61file_name_for_report = 'report_' + nick +'.html'62report = os.path.join(exp.eval_dir, file_name_for_report)63file_name_for_preprocess = os.path.join(exp.eval_dir, 'preprocess')64exp.add_report(AbsoluteReport(attributes=ATTRIBUTES), outfile=report)65# Plot 66sub_dir = 'plots_' + nick67exp.add_step(Step('report-plot-cat',68 ProblemPlotReport(),69 exp.eval_dir, os.path.join(exp.eval_dir, sub_dir)))70# "Publish" the results with "cat" for demonstration purposes.71# exp.add_step(Step('publish-report', subprocess.call, ['cat', report]))...
__init__.py
Source:__init__.py
1# Miro - an RSS based video player application2# Copyright 2009 - Participatory Culture Foundation3# 4# This file is part of vidscraper.5# 6# Redistribution and use in source and binary forms, with or without7# modification, are permitted provided that the following conditions8# are met:9# 10# 1. Redistributions of source code must retain the above copyright11# notice, this list of conditions and the following disclaimer.12# 2. Redistributions in binary form must reproduce the above copyright13# notice, this list of conditions and the following disclaimer in the14# documentation and/or other materials provided with the distribution.15# 16# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR17# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES18# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.19# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,20# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT21# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF25# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.26import copy27#from vidscraper import errors28from vidscraper.metasearch.sites import (youtube, vimeo)29AUTOSEARCH_SUITES = [youtube.SUITE, vimeo.SUITE]30def auto_search(include_terms, exclude_terms=None,31 order_by='relevant', **kwargs):32 suite_results = []33 for suite in AUTOSEARCH_SUITES:34 if order_by in suite['order_bys']:35 suite_results.append(36 (suite,37 suite['func'](38 include_terms=include_terms,39 exclude_terms=exclude_terms or [],40 order_by=order_by, **kwargs)))41 return suite_results42def unfriendlysort_results(results, add_suite=True):43 """44 Just slop the results together.45 """46 new_results = []47 video_id = 048 for suite, this_results in results:49 for result in this_results:50 if add_suite:51 result['suite'] = suite52 result['id'] = video_id53 video_id += 154 new_results.extend(this_results)55 return new_results56def intersperse_results(results, add_suite=True):57 """58 Intersperse the results of a suite search59 """60 new_results = []61 len_biggest_list = max([len(r[1]) for r in results])62 video_id = 063 for i in range(len_biggest_list):64 for suite, this_results in results:65 if video_id < len(this_results):66 result = this_results[i]67 if add_suite:68 result['suite'] = suite69 result['id'] = video_id70 video_id += 171 new_results.append(result)...
test_suites.py
Source:test_suites.py
1import json2import responses3def add_suite(r):4 data = json.loads(r.body.decode())5 return 200, {}, json.dumps({'id': 1, 'name': data['name'], 'description': data['description']})6def test_get_suite(api, mock, host):7 mock.add_callback(8 responses.GET,9 '{}index.php?/api/v2/get_suite/4'.format(host),10 lambda x: (200, {}, json.dumps({'id': 4, 'description': 'My suite'}))11 )12 resp = api.suites.get_suite(4)13 assert resp['id'] == 414def test_get_suites(api, mock, host):15 mock.add_callback(16 responses.GET,17 '{}index.php?/api/v2/get_suites/5'.format(host),18 lambda x: (200, {}, json.dumps([{'id': 1, 'description': 'Suite1'}, {'id': 2, 'description': 'Suite2'}]))19 )20 resp = api.suites.get_suites(5)21 assert resp[0]['id'] == 122 assert resp[1]['description'] == 'Suite2'23def test_add_suite(api, mock, host):24 mock.add_callback(25 responses.POST,26 '{}index.php?/api/v2/add_suite/7'.format(host),27 add_suite28 )29 resp = api.suites.add_suite(7, 'New suite', description='My new suite')30 assert resp['name'] == 'New suite'31 assert resp['description'] == 'My new suite'32def test_update_suite(api, mock, host):33 mock.add_callback(34 responses.POST,35 '{}index.php?/api/v2/update_suite/4'.format(host),36 add_suite37 )38 resp = api.suites.update_suite(4, name='new name', description='new description')39 assert resp['name'] == 'new name'40 assert resp['description'] == 'new description'41def test_delete_suite(api, mock, host):42 mock.add_callback(43 responses.POST,...
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!!