How to use take_action method in stestr

Best Python code snippet using stestr_python

test_project.py

Source:test_project.py Github

copy

Full Screen

...27 def test_create_repo_state(self):28 self.mock_create_repo()29 p = self.mk_project()30 pw = p.get_website_manager().workflow31 pw.take_action('create_repo')32 self.assertEquals(33 p.own_repo().url,34 self.source_repo_sm.repo.git_dir)35 self.assertEquals(p.state, 'repo_created')36 self.assertEqual(len(responses.calls), 1)37 self.assertIn('Authorization', responses.calls[0].request.headers)38 @responses.activate39 def test_create_repo_bad_response(self):40 self.mock_create_repo(status=404, data={'message': 'Not authorized'})41 p = self.mk_project()42 with self.assertRaises(exceptions.GithubApiException):43 pw = p.get_website_manager().workflow44 pw.take_action('create_repo')45 self.assertEquals(p.state, 'initial')46 @responses.activate47 def test_clone_repo(self):48 self.mock_create_repo()49 p = self.mk_project()50 pw = p.get_website_manager().workflow51 pw.take_action('create_repo')52 pw.take_action('clone_repo')53 self.assertEquals(p.state, 'repo_cloned')54 self.assertTrue(os.path.isdir(os.path.join(p.repo_path(), '.git')))55 self.assertFalse(56 os.path.exists(os.path.join(p.repo_path(), 'README.md')))57 self.assertTrue(58 os.path.exists(os.path.join(p.repo_path(), 'text.txt')))59 self.addCleanup(lambda: shutil.rmtree(p.repo_path()))60 @responses.activate61 def test_create_remotes_repo(self):62 self.mock_create_repo()63 p = self.mk_project(repo={'base_url': self.base_repo_sm.repo.git_dir})64 pw = p.get_website_manager().workflow65 pw.take_action('create_repo')66 pw.take_action('clone_repo')67 pw.take_action('create_remote')68 self.assertEquals(p.state, 'remote_created')69 self.assertTrue(os.path.isdir(os.path.join(p.repo_path(), '.git')))70 repo = Repo(p.repo_path())71 self.assertEquals(len(repo.remotes), 2)72 self.assertEquals(73 repo.remote(name='upstream').url,74 self.base_repo_sm.repo.git_dir)75 self.addCleanup(lambda: shutil.rmtree(p.repo_path()))76 @skip("slow test that connects to github")77 def test_create_remotes_repo_from_github(self): # pragma: no cover78 self.mock_create_repo()79 p = self.mk_project(repo={80 'base_url': 'git://github.com/universalcore/'81 'unicore-cms-content-gem-tanzania.git'})82 pw = p.get_website_manager().workflow83 pw.take_action('create_repo')84 pw.take_action('clone_repo')85 pw.take_action('create_remote')86 pw.take_action('merge_remote')87 self.assertEquals(p.state, 'remote_merged')88 self.assertTrue(os.path.isdir(os.path.join(p.repo_path(), '.git')))89 self.assertTrue(90 os.path.exists(os.path.join(p.repo_path(), 'README.md')))91 repo = Repo(p.repo_path())92 self.assertEquals(len(repo.remotes), 2)93 self.assertEquals(94 repo.remote(name='upstream').url,95 ('git://github.com/universalcore/'96 'unicore-cms-content-gem-tanzania.git'))97 self.addCleanup(lambda: shutil.rmtree(p.repo_path()))98 @responses.activate99 def test_merge_remote_repo(self):100 self.mock_create_repo()101 p = self.mk_project(repo={'base_url': self.base_repo_sm.repo.git_dir})102 pw = p.get_website_manager().workflow103 pw.take_action('create_repo')104 pw.take_action('clone_repo')105 pw.take_action('create_remote')106 pw.take_action('merge_remote')107 self.assertEquals(p.state, 'remote_merged')108 self.assertTrue(os.path.isdir(os.path.join(p.repo_path(), '.git')))109 self.assertTrue(110 os.path.exists(os.path.join(p.repo_path(), 'sample.txt')))111 repo = Repo(p.repo_path())112 workspace = self.mk_workspace(113 working_dir=settings.CMS_REPO_PATH,114 name='ffl-za',115 index_prefix='unicore_cms_ffl_za')116 self.assertEqual(workspace.S(Category).count(), 1)117 self.assertEqual(workspace.S(Page).count(), 1)118 self.assertEqual(workspace.S(EGLocalisation).count(), 1)119 self.assertEquals(len(repo.remotes), 2)120 self.assertEquals(121 repo.remote(name='upstream').url,122 self.base_repo_sm.repo.git_dir)123 self.addCleanup(lambda: shutil.rmtree(p.repo_path()))124 @responses.activate125 def test_push_repo(self):126 self.mock_create_repo()127 p = self.mk_project(repo={'base_url': self.base_repo_sm.repo.git_dir})128 pw = p.get_website_manager().workflow129 pw.take_action('create_repo')130 pw.take_action('clone_repo')131 pw.take_action('create_remote')132 pw.take_action('merge_remote')133 self.assertFalse(os.path.exists(os.path.join(134 self.base_repo_sm.repo.working_dir, 'text.txt')))135 pw.take_action('push_repo')136 self.assertEquals(p.state, 'repo_pushed')137 self.assertTrue(os.path.exists(os.path.join(138 self.source_repo_sm.repo.working_dir, 'text.txt')))139 self.addCleanup(lambda: shutil.rmtree(p.repo_path()))140 @responses.activate141 def test_init_workspace(self):142 self.mock_create_repo()143 self.mock_create_webhook()144 self.mock_create_unicore_distribute_repo()145 p = self.mk_project(repo={'base_url': self.base_repo_sm.repo.git_dir})146 pw = p.get_website_manager().workflow147 pw.take_action('create_repo')148 pw.take_action('clone_repo')149 pw.take_action('create_remote')150 pw.take_action('merge_remote')151 pw.take_action('push_repo')152 pw.take_action('create_webhook')153 self.assertEqual(len(responses.calls), 2)154 self.assertIn('Authorization', responses.calls[-1].request.headers)155 pw.take_action('init_workspace')156 self.assertEquals(p.state, 'workspace_initialized')157 workspace = self.mk_workspace(158 working_dir=settings.CMS_REPO_PATH,159 name='ffl-za',160 index_prefix='unicore_cms_ffl_za')161 self.assertEqual(workspace.S(Category).count(), 1)162 self.assertEqual(workspace.S(Page).count(), 1)163 self.assertEqual(workspace.S(EGLocalisation).count(), 1)164 cat = Category({165 'title': 'Some title',166 'slug': 'some-slug'167 })168 workspace.save(cat, 'Saving a Category')169 page = Page({170 'title': 'Some page title',171 'slug': 'some-page-slug'172 })173 workspace.save(page, 'Saving a Page')174 loc = EGLocalisation({175 'locale': 'spa_ES',176 'image': 'some-image-uuid',177 'image_host': 'http://some.site.com',178 })179 workspace.save(loc, 'Saving a Localisation')180 workspace.refresh_index()181 self.assertEqual(workspace.S(Category).count(), 2)182 self.assertEqual(workspace.S(Page).count(), 2)183 self.assertEqual(workspace.S(EGLocalisation).count(), 2)184 self.addCleanup(lambda: shutil.rmtree(p.repo_path()))185 @responses.activate186 def test_create_nginx_config(self):187 self.mock_create_repo()188 self.mock_create_webhook()189 self.mock_create_unicore_distribute_repo()190 p = self.mk_project(repo={'base_url': self.base_repo_sm.repo.git_dir})191 pw = p.get_website_manager().workflow192 pw.take_action('create_repo')193 pw.take_action('clone_repo')194 pw.take_action('create_remote')195 pw.take_action('merge_remote')196 pw.take_action('push_repo')197 pw.take_action('create_webhook')198 pw.take_action('init_workspace')199 pw.take_action('create_nginx')200 cms_nginx_config_path = os.path.join(201 settings.NGINX_CONFIGS_PATH,202 'cms_ffl_za.conf')203 self.assertTrue(os.path.exists(cms_nginx_config_path))204 with open(cms_nginx_config_path, "r") as config_file:205 data = config_file.read()206 self.assertTrue('ffl-za-%s.qa-content.unicore.io' % p.id in data)207 self.assertTrue('unicore_cms_django_ffl_za-access.log' in data)208 self.assertTrue('unicore_cms_django_ffl_za-error.log' in data)209 self.addCleanup(lambda: shutil.rmtree(p.repo_path()))210 @responses.activate211 def test_create_pyramid_settings(self):212 self.mock_create_repo()213 self.mock_create_webhook()214 self.mock_create_hub_app()215 self.mock_create_unicore_distribute_repo()216 p = self.mk_project(217 repo={'base_url': self.base_repo_sm.repo.git_dir},218 project={'ga_profile_id': 'UA-some-profile-id'})219 p.available_languages.add(Localisation._for('eng_UK'))220 pw = p.get_website_manager().workflow221 pw.take_action('create_repo')222 pw.take_action('clone_repo')223 pw.take_action('create_remote')224 pw.take_action('merge_remote')225 pw.take_action('push_repo')226 pw.take_action('create_webhook')227 pw.take_action('init_workspace')228 pw.take_action('create_nginx')229 pw.take_action('create_hub_app')230 pw.take_action('create_pyramid_settings')231 frontend_settings_path = os.path.join(232 settings.FRONTEND_SETTINGS_OUTPUT_PATH,233 'ffl_za.ini')234 self.assertTrue(os.path.exists(frontend_settings_path))235 with open(frontend_settings_path, "r") as config_file:236 data = config_file.read()237 self.assertTrue('egg:unicore-cms-ffl' in data)238 self.assertTrue(239 "[(u'eng_UK', u'English')]" in data)240 self.assertTrue(241 'git.path = http://servicehost:6543/repos/'242 'unicore-cms-content-ffl-za.json' in data)243 self.assertTrue('pyramid.default_locale_name = eng_GB' in data)244 self.assertTrue('ga.profile_id = UA-some-profile-id' in data)245 self.addCleanup(lambda: shutil.rmtree(p.repo_path()))246 @responses.activate247 def test_create_springboard_settings(self):248 self.mock_create_repo()249 self.mock_create_webhook()250 self.mock_create_hub_app()251 self.mock_create_unicore_distribute_repo()252 p = self.mk_project(253 repo={'base_url': self.base_repo_sm.repo.git_dir},254 project={'ga_profile_id': 'UA-some-profile-id'},255 app_type={'project_type': 'springboard'})256 p.available_languages.add(Localisation._for('eng_GB'))257 other_repo = self.mk_project(258 project={'country': 'UK'},259 app_type={'name': 'gem'}).own_repo()260 p.external_repos.add(other_repo)261 self.addCleanup(lambda: shutil.rmtree(p.repo_path()))262 pw = p.get_website_manager().workflow263 pw.take_action('create_repo')264 pw.take_action('clone_repo')265 pw.take_action('create_remote')266 pw.take_action('merge_remote')267 pw.take_action('push_repo')268 pw.take_action('create_webhook')269 pw.take_action('init_workspace')270 pw.take_action('create_nginx')271 pw.take_action('create_hub_app')272 pw.take_action('create_pyramid_settings')273 springboard_settings_path = os.path.join(274 settings.SPRINGBOARD_SETTINGS_OUTPUT_PATH,275 'ffl_za.ini')276 self.assertTrue(os.path.exists(springboard_settings_path))277 with open(springboard_settings_path, "r") as config_file:278 data = config_file.read()279 self.assertTrue('egg:springboard_ffl' in data)280 self.assertTrue('eng_GB' in data)281 self.assertTrue(282 'unicore.content_repo_urls =\n'283 ' http://servicehost:6543/repos/unicore-cms-content-ffl-za.json'284 '\n'285 ' http://servicehost:6543/repos/unicore-cms-content-gem-uk.json'286 in data)287 self.assertTrue('pyramid.default_locale_name = eng_GB' in data)288 self.assertTrue('ga.profile_id = UA-some-profile-id' in data)289 def test_ordering(self):290 p1 = self.mk_project(repo={'base_url': self.base_repo_sm.repo.git_dir})291 p2 = self.mk_project(292 repo={'base_url': self.base_repo_sm.repo.git_dir},293 project={'country': 'KE'},294 app_type={'name': 'gem', 'title': 'Girl Effect Mobile',295 'project_type': 'unicore-cms'})296 p3 = self.mk_project(297 repo={'base_url': self.base_repo_sm.repo.git_dir},298 project={'country': 'KE'})299 self.assertEquals(Project.objects.all()[0], p3)300 self.assertEquals(Project.objects.all()[1], p1)301 self.assertEquals(Project.objects.all()[2], p2)302 self.assertEquals(303 str(Project.objects.all()[0].application_type),304 'Facts for Life (unicore-cms)')305 def get_mock_app_client(self):306 mock_app_client = mock.Mock()307 mock_app_client.get_app = mock.Mock()308 mock_app_client.get_app.return_value = mock.Mock()309 mock_app_client.create_app = mock.Mock()310 mock_app_client.create_app.return_value = mock.Mock()311 return mock_app_client312 @mock.patch('unicoremc.models.get_hub_app_client')313 def test_hub_app(self, mock_get_client):314 proj = self.mk_project(315 repo={'base_url': self.base_repo_sm.repo.git_dir},316 app_type={'name': 'gem', 'title': 'Girl Effect Mobile',317 'project_type': 'unicore-cms'})318 self.assertEqual(proj.hub_app(), None)319 app_client = self.get_mock_app_client()320 mock_get_client.return_value = app_client321 proj.hub_app_id = 'abcd'322 app = proj.hub_app()323 self.assertTrue(app)324 app_client.get_app.assert_called_with(proj.hub_app_id)325 # check that the object isn't fetched again on subsequent calls326 self.assertEqual(app, proj.hub_app())327 self.assertEqual(app_client.get_app.call_count, 1)328 @responses.activate329 def test_create_or_update_hub_app(self):330 ffl = AppType._for(331 'ffl', 'Facts for Life', 'unicore-cms',332 'universalcore/unicore-cms-ffl')333 proj = self.mk_project(334 repo={'base_url': self.base_repo_sm.repo.git_dir},335 app_type={'name': 'gem', 'title': 'Girl Effect Mobile',336 'project_type': 'unicore-cms'})337 self.mock_create_hub_app(uuid='foouuid')338 app = proj.create_or_update_hub_app()339 self.assertEqual(proj.hub_app_id, 'foouuid')340 self.assertEqual(proj.hub_app(), app)341 self.assertIn(342 '"title": "%s"' % proj.hub_app_title(),343 responses.calls[0].request.body)344 self.assertIn(345 '"url": "%s"' % proj.frontend_url(),346 responses.calls[0].request.body)347 responses.reset()348 responses.add(349 responses.GET, re.compile(r'.*/apps/foouuid'),350 body=json.dumps(app.data),351 status=200,352 content_type='application/json')353 responses.add(354 responses.PUT, re.compile(r'.*/apps/foouuid'),355 body='{}', status=200, content_type='application/json')356 proj.application_type = ffl357 app = proj.create_or_update_hub_app()358 self.assertIn(proj.application_type.title, app.get('title'))359 self.assertIn('ffl', app.get('url'))360 @responses.activate361 def test_create_marathon_app_bad_response(self):362 def call_mock(*call_args, **call_kwargs):363 pass364 self.mock_create_repo()365 self.mock_create_webhook()366 self.mock_create_hub_app()367 self.mock_create_unicore_distribute_repo()368 self.mock_create_marathon_app(404)369 p = self.mk_project(370 repo={'base_url': self.base_repo_sm.repo.git_dir},371 project={'ga_profile_id': 'UA-some-profile-id'},372 app_type={'project_type': 'springboard'})373 p.available_languages.add(Localisation._for('eng_GB'))374 self.addCleanup(lambda: shutil.rmtree(p.repo_path()))375 pw = p.get_website_manager().workflow376 pw.take_action('create_repo')377 pw.take_action('clone_repo')378 pw.take_action('create_remote')379 pw.take_action('merge_remote')380 pw.take_action('push_repo')381 pw.take_action('create_webhook')382 pw.take_action('init_workspace')383 pw.take_action('create_nginx')384 pw.take_action('create_hub_app')385 pw.take_action('create_pyramid_settings')386 pw.take_action('create_cms_settings')387 p.db_manager.call_subprocess = call_mock388 pw.take_action('create_db')389 p.db_manager.call_subprocess = call_mock390 pw.take_action('init_db')391 with self.assertRaises(exceptions.MarathonApiException):...

Full Screen

Full Screen

knots.py

Source:knots.py Github

copy

Full Screen

...19def toggle_animation(obj, frame, animate):20 # Sets the obj to be animable or non-animable at particular frame21 obj.rigid_body.kinematic = animate22 obj.keyframe_insert(data_path="rigid_body.kinematic", frame=frame)23def take_action(obj, frame, action_vec, animate=True):24 # Keyframes a displacement for obj given by action_vec at given frame25 curr_frame = bpy.context.scene.frame_current26 dx,dy,dz = action_vec27 if animate != obj.rigid_body.kinematic:28 # We are "picking up" a dropped object, so we need its updated location29 obj.location = obj.matrix_world.translation30 obj.rotation_euler = obj.matrix_world.to_euler()31 obj.keyframe_insert(data_path="location", frame=curr_frame)32 obj.keyframe_insert(data_path="rotation_euler", frame=curr_frame)33 toggle_animation(obj, curr_frame, animate)34 obj.location += Vector((dx,dy,dz))35 obj.rotation_euler = obj.matrix_world.to_euler()36 obj.keyframe_insert(data_path="location", frame=frame)37 obj.keyframe_insert(data_path="rotation_euler", frame=frame)38def tie_pretzel_knot(params, chain=False, render=False):39 piece = "Cylinder"40 last = params["num_segments"]-141 end1 = get_piece(piece, -1)42 end2 = get_piece(piece, last)43 for i in range(last+1):44 obj = get_piece(piece, i if i != 0 else -1)45 take_action(obj, 1, (0,0,0), animate=(i==0 or i==last))46 # Wrap endpoint one circularly around endpoint 247 take_action(end2, 80, (10,0,0))48 take_action(end1, 80, (-15,5,0))49 take_action(end1, 120, (-1,-7,0))50 take_action(end1, 150, (3,0,-4))51 take_action(end1, 170, (0,2.5,0))52 # Thread endpoint 1 through the loop (downward)53 take_action(end1, 180, (0,0,-2))54 # Pull to tighten knot55 take_action(end1, 200, (5,0,2))56 take_action(end2, 200, (0,0,0))57 take_action(end1, 230, (8,0,5))58 take_action(end2, 230, (-6,0,0))59 take_action(end1, 260, (-1,0,-1))60 take_action(end2, 260, (1,0,-1))61 toggle_animation(end1, 280, False)62 toggle_animation(end2, 280, False)63 ## Reidemeister64 for step in range(1, 350):65 bpy.context.scene.frame_set(step)66 #if render:67 # render_frame(step, render_offset=render_offset)68 return 35069def tie_figure_eight(params, chain=False, render=False):70 piece = "Cylinder"71 last = params["num_segments"]-172 end1 = get_piece(piece, -1)73 end2 = get_piece(piece, last)74 for i in range(last+1):75 obj = get_piece(piece, i if i != 0 else -1)76 take_action(obj, 1, (0,0,0), animate=(i==0 or i==last))77 take_action(end2, 80, (10,0,2))78 take_action(end1, 80, (-15,2,2))79 take_action(end2, 130, (1,3,0))80 take_action(end2, 180, (-4,0,0))81 take_action(end2, 200, (0,-2,0))82 take_action(end2, 250, (4.5,-0.25,-6))83 take_action(end2, 300, (0,0,-2))84 take_action(end2, 350, (9,0,8))85 take_action(end2, 400, (-16,0,0))86 take_action(end1, 350, (0,0,0))87 take_action(end1, 400, (14,-2,-2))88 # Take some time to settle89 toggle_animation(end1, 450, False)90 toggle_animation(end2, 450, False)91 for step in range(1, 500):92 bpy.context.scene.frame_set(step)93 #if render:94 # render_frame(step)95 return 50096def tie_stevedore(params, chain=False, render=False):97 piece = "Cylinder"98 last = params["num_segments"]-199 end1 = get_piece(piece, -1)100 end2 = get_piece(piece, last)101 for i in range(last+1):102 obj = get_piece(piece, i if i != 0 else -1)103 take_action(obj, 1, (0,0,0), animate=(i==0 or i==last))104 take_action(end2, 80, (10,0,2))105 take_action(end1, 80, (-15,2,2))106 take_action(end2, 100, (1,3,0))107 take_action(end2, 130, (-4,0,0))108 take_action(end2, 150, (0,-2,0))109 take_action(end2, 170, (3,0,0))110 take_action(end2, 190, (0,2,0))111 take_action(end2, 210, (-2,0,0))112 take_action(end2, 230, (0,-2,0))113 take_action(end2, 300, (3.5,-0.25,-6))114 take_action(end2, 310, (0,0,-3))115 take_action(end2, 350, (9,0,8))116 take_action(end1, 350, (0,0,0))117 #take_action(end2, 400, (-16,0,-3))118 #take_action(end1, 400, (8,-2,-5))119 take_action(end2, 400, (-12,0,-3))120 take_action(end1, 400, (12,-2,-5))121 # Take some time to settle122 toggle_animation(end1, 430, False)123 toggle_animation(end2, 430, False)124 for step in range(1, 470):125 bpy.context.scene.frame_set(step)126 #if render:127 # render_frame(step)128 return 470129def tie_double_pretzel(params, chain=False, render=False):130 piece = "Cylinder"131 last = params["num_segments"]-1132 end1 = get_piece(piece, -1)133 end2 = get_piece(piece, last)134 for i in range(last+1):135 obj = get_piece(piece, i if i != 0 else -1)136 take_action(obj, 1, (0,0,0), animate=(i==0 or i==last))137 take_action(end2, 80, (5,0,-1))138 take_action(end1, 80, (-20,2,2))139 take_action(end2, 100, (2,2,0))140 take_action(end1, 100, (0,0,0))141 take_action(end1, 150, (6,-1,0))142 take_action(end2, 150, (0,0,0))143 take_action(end2, 200, (2,-1.5,-3))144 take_action(end2, 220, (0,0,-3))145 take_action(end2, 240, (-6,0,0))146 take_action(end1, 240, (0,0,0))147 take_action(end2, 300, (-3,0,5))148 take_action(end1, 300, (4,0,0))149 take_action(end1, 320, (0,0,0))150 take_action(end1, 360, (-11,3,-5))151 take_action(end1, 380, (-1,-3,0))152 take_action(end1, 410, (1,1,-2))153 take_action(end1, 430, (-2,6,2))154 take_action(end1, 460, (0,0,0))155 take_action(end1, 490, (0,-5,3))156 take_action(end2, 490, (0,0,0))157 take_action(end2, 520, (11,0,-2))158 take_action(end1, 520, (18,-3,-2))159 toggle_animation(end1, 540, False)160 toggle_animation(end2, 540, False)161 for step in range(1, 560):162 bpy.context.scene.frame_set(step)163 #if render:164 # render_frame(step)165 return 560166def tie_knot_7(params, chain=False, render=True):167 piece = "Cylinder"168 last = params["num_segments"]-1169 end1 = get_piece(piece, -1)170 end2 = get_piece(piece, last)171 for i in range(last+1):172 obj = get_piece(piece, i if i != 0 else -1)173 take_action(obj, 1, (0,0,0), animate=(i==0 or i==last))174 take_action(end2, 80, (11,0,3))175 take_action(end1, 80, (-7,2,-1))176 take_action(end2, 130, (0,-3,-2))177 take_action(end2, 150, (4,0,-2))178 take_action(end1, 180, (0,0,0))179 take_action(end2, 180, (0,6,-1))180def tie_cornell1_knot(params, chain=False, render=True):181 piece = "Cylinder"182 last = params["num_segments"]-1183 end1 = get_piece(piece, -1)184 end2 = get_piece(piece, last)185 for i in range(last+1):186 obj = get_piece(piece, i if i != 0 else -1)187 take_action(obj, 1, (0,0,0), animate=(i==0 or i==last))188 # make center loop189 take_action(end2, 80, (10,1,5))190 # take_action(end2, 120, (3,1,-3))191 take_action(end2, 120, (3,2,-3))192 take_action(end2, 160, (0,-3,-2))193 take_action(end2, 200, (0,-2,-4))194 toggle_animation(end2, 200, False)195 toggle_animation(end2, 200, True)196 take_action(end2, 240, (0,-1,2))197 take_action(end2, 280, (-4,3,-2))198 # move other end across199 take_action(end1, 80, (-10,1,5))200 take_action(end1, 120, (-5,0,0))201 take_action(end1, 160, (0,-2,-4))202 toggle_animation(end1, 160, False)203 toggle_animation(end1, 160, True)204 take_action(end2, 320, (0,-1,0))205 # take_action(end2, 320, (1,-1,0))206 take_action(end1, 360, (6,0,-5))207 # take_action(end1, 360, (5,0,-5))208 toggle_animation(end1, 360, False)209 toggle_animation(end2, 360, False)210 settle_time = 10211 ## Reidemeister212 for step in range(1, 360+settle_time):213 bpy.context.scene.frame_set(step)214 if render:215 render_frame(step, render_offset=render_offset)216 return 360217def tie_cornell2_knot(params, chain=False, render=False):218 end_frame = tie_pretzel_knot(params, chain=chain, render=render)219 for _ in range(2):220 end_frame = rend.random_loosen(params, end_frame, render=render, mapping={}, annot=False)221 return end_frame...

Full Screen

Full Screen

example_game.py

Source:example_game.py Github

copy

Full Screen

...18 Player.GREEN: Card.ARREST_FAMILY,19 }20 )21 # Round 122 gs.take_action(Move(Location(5), skip_assistant=False))23 gs.take_action(GenericTileAction())24 gs.take_action(EncounterSmuggler(Good.BLUE, Good.YELLOW, (4, 4)))25 gs.take_action(YieldTurn())26 gs.take_action(Move(Location(3), skip_assistant=False))27 gs.take_action(GenericTileAction())28 gs.take_action(YieldTurn())29 gs.take_action(Move(Location(8), skip_assistant=False))30 gs.take_action(GenericTileAction())31 gs.take_action(YieldTurn())32 gs.take_action(Move(Location(2), skip_assistant=False))33 gs.take_action(GenericTileAction())34 gs.take_action(YieldTurn())35 # Round 236 gs.take_action(Move(Location(1), skip_assistant=False))37 gs.take_action(OneGoodCardAction(Good.BLUE))38 gs.take_action(MosqueAction(Good.BLUE))39 gs.take_action(YieldTurn())40 gs.take_action(Move(Location(4), skip_assistant=False))41 gs.take_action(MosqueAction(Good.RED))42 gs.take_action(YieldTurn())43 gs.take_action(Move(Location(6), skip_assistant=False))44 gs.take_action(PoliceStationAction(Location(4), MosqueAction(Good.GREEN)))45 gs.take_action(YieldTurn())46 gs.take_action(Move(Location(5), skip_assistant=False))47 gs.take_action(GenericTileAction())48 gs.take_action(YieldTurn())49 # Round 350 gs.take_action(Move(Location(2), skip_assistant=False))51 gs.take_action(GenericTileAction())52 gs.take_action(YieldTurn())53 gs.take_action(Move(Location(8), skip_assistant=False))54 gs.take_action(GenericTileAction())55 gs.take_action(YieldTurn())56 gs.take_action(Move(Location(9), skip_assistant=False))57 gs.take_action(BlackMarketAction(Good.GREEN, (4, 1)))58 gs.take_action(EncounterGovernor(Card.FIVE_LIRA, Pay(), (2, 3)))59 gs.take_action(EncounterSmuggler(Good.BLUE, Good.GREEN, (2, 5)))60 gs.take_action(YieldTurn())61 gs.take_action(Move(Location(6), skip_assistant=False))62 gs.take_action(PoliceStationAction(Location(15), GenericTileAction()))63 gs.take_action(YieldTurn())...

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