How to use create_object method in tempest

Best Python code snippet using tempest_python

old_scenes.py

Source:old_scenes.py Github

copy

Full Screen

...129 color=(1, 1, 1),130 reflection=0.9131 )132 sphere = ray_tracer.create_sphere()133 ray_tracer.create_object(sphere, shiny_material, (0, 20, -10), 5)134 # ray_tracer.create_object(sphere, shiny_material, (20, 20, 40), 7)135 # ray_tracer.create_object(sphere, wall_material_5, (0, 0, 0), 7)136 ray_tracer.create_object(sphere, very_shiny_material, (20, 0, -10), 1)137# moving = ray_tracer.create_object(sphere, normal_material, (-14, 0, 0), (3, 3, 3))138# ray_tracer.set_velocity(moving, (3, 3, 0))139# ray_tracer.create_object(sphere, glass, (10, -15, 0), 5)140# ray_tracer.create_object(sphere, silver, (-10, -14, 0), 6)141 plane = ray_tracer.create_plane()142 ray_tracer.create_object(plane, wall_material_1, (0, 0, -20), (1, 1, 1), (0, 0, 1))143 # ray_tracer.create_object(plane, wall_material_2, (20, 0, 0), (1, 1, 1), (-1, 0, 0))144 # ray_tracer.create_object(plane, wall_material_3, (-20, 0, 0), (1, 1, 1), (1, 0, 0))145 ray_tracer.create_object(plane, wall_material_4, (0, 20, 0), (1, 1, 1), (0, -1, 0))146 ray_tracer.create_object(plane, wall_material_5, (0, -20, 0), (1, 1, 1), (0, 1, 0))147 ray_tracer.c_color_gamma = 1.0 / 2.5148 # mesh = ray_tracer.create_mesh(filename='/Users/Iterator/pytracer/meshes/Espresso_Cup.obj')149 #meshes/2l9281qs868w-Model/OBJ/FarmhouseOBJ.obj150 # ray_tracer.create_object(mesh, glass, (0, -20, 0), 1)151 # mesh = ray_tracer.create_mesh(filename='meshes/peri/peri.obj')152 # ray_tracer.create_object(mesh, wall_material_5, (0, -10, 0), 0.1)153 # mesh = ray_tracer.create_mesh(filename='meshes/bunny.fine.obj')154 # ray_tracer.create_object(mesh, wall_material_5, (0, -20, -20), 100)155 # mesh = ray_tracer.create_mesh(filename='meshes/bunny.fine.obj')156 # ray_tracer.create_object(mesh, silver, (0, -10, -10), 1)157 # mesh = ray_tracer.create_mesh(filename='meshes/Espresso_Cup.obj')158 # ray_tracer.create_object(mesh, normal_material, (0, -20, -10), 2)159 # mesh = ray_tracer.create_mesh(filename='meshes/bunny.obj')160 # ray_tracer.create_object(mesh, glass, (0, -20, 0), 90)161 gold = ray_tracer.create_material(162 color=(1.0, 0.8, 0.4),163 emit=(0, 0, 0),164 reflection=0.7,165 specular=0.0,166 diffuse=0.9167 )168 # mesh = ray_tracer.create_mesh(filename='/Users/Iterator/pytracer/meshes/fixed.perfect.dragon.100K.0.07.obj')169 # ray_tracer.create_object(mesh, gold, (0, 0, 0), 10)170 # mesh = ray_tracer.create_mesh(filename='meshes/spoon/spoon.obj')171 # spoon = ray_tracer.create_object(mesh, glass, (0, -20, 0), .2)172 # ray_tracer.rotate(spoon, (0, 1, 0), 0.4)173 # mesh = ray_tracer.create_mesh(filename='meshes/sphere.obj')174 # spoon = ray_tracer.create_object(mesh, glass, (0, -15, 0), 5)175 # print mesh176 ray_tracer.c_apertureRadius = 0.3177 ray_tracer.c_focus = (0, 0, 0)178def add_spheres_2():179 shiny_material = ray_tracer.create_material(180 emit=2,181 )182 wall_material = ray_tracer.create_material(183 color=(0.75, 0.75, 0.75),184 emit=0.0,185 reflection=0.1,186 diffuse=1.0187 )188 pink = ray_tracer.create_material(189 color=(1.0, 0.5, 0.5),190 reflection=0.5,191 specular=0.0,192 diffuse=1.5193 )194 yello = ray_tracer.create_material(195 color=(1.0, 0.8, 0.4),196 reflection=0.1,197 specular=0.0,198 diffuse=0.9199 )200 bright_yello = ray_tracer.create_material(201 color=(1.0, 0.8, 0.4),202 reflection=0.7,203 specular=0.0,204 diffuse=0.9205 )206 red = ray_tracer.create_material(207 color=(1.0, 0.3, 0.2),208 emit=(0.2, 0.1, 0),209 reflection=0.2,210 specular=0.0,211 diffuse=0.7212 )213 blue = ray_tracer.create_material(214 color=(0.2, 0.3, 1.0),215 reflection=0.3,216 reflection_noise=0.01,217 specular=0.3,218 diffuse=0.8,219 )220 green = ray_tracer.create_material(221 color=(0.3, 1.0, 0.3),222 emit=0.05,223 reflection=0.6,224 specular=0.0,225 diffuse=0.9226 )227 sphere = ray_tracer.create_sphere()228 #emit 0.1!229 # ray_tracer.create_object(sphere, shiny_material, (600, 600, -10), (200, 0.1, 200))230 ray_tracer.create_object(sphere, shiny_material, (-200, 200, -10), (200, 200, 200))231 # ray_tracer.create_object(sphere, shiny_material, (0, 200, 0), (200, 200, 200))232 ray_tracer.create_object(sphere, shiny_material, (5, -10, 38), 1.6)233 ray_tracer.create_object(sphere, pink, (-24, -5, 0), 5)234 ray_tracer.create_object(sphere, yello, (20, -5, -10), (5, 16, 5))235 ray_tracer.create_object(sphere, blue, (0, 0, 30), 7)236 ray_tracer.create_object(sphere, bright_yello, (10, -8, 30), 2)237 ray_tracer.create_object(sphere, green, (-6, -5, 50), 4)238 ray_tracer.create_object(sphere, yello, (10, -7, 45), 3)239 plane = ray_tracer.create_plane()240 ray_tracer.create_object(plane, wall_material, (0, -10, 0), (1, 1, 1), (0, 1, 0))241 ray_tracer.create_object(plane, wall_material, (0, 0, -100), (1, 1, 1), (0, 0, 1))242 ray_tracer.rotate_view_port((1, 0, 0), 0.1)243 ray_tracer.c_color_gamma = 1.0 / 2.2244 ray_tracer.c_apertureRadius = 0.6245 ray_tracer.c_focus = (0, 0, 30)246 ray_tracer.c_show_variance = 0247def show_materials():248 sphere = ray_tracer.create_sphere()249 ray_tracer.create_object(sphere, Materials.sun, (-200, 200, -10), (200, 200, 200))250 plane = ray_tracer.create_plane()251 ray_tracer.create_object(plane, Materials.wall, (0, -10, 0), (1, 1, 1), (0, 1, 0))252 ray_tracer.create_object(plane, Materials.wall, (0, 0, -100), (1, 1, 1), (0, 0, 1))253 ray_tracer.rotate_view_port((1, 0, 0), 0.0)254 ray_tracer.c_color_gamma = 1.0 / 2.2255 ray_tracer.c_apertureRadius = 0.0256 ray_tracer.c_focus = (0, 0, 0)257 ray_tracer.c_show_variance = 0258 counter = 0259 for material_name in Materials.__dict__:260 if material_name.startswith('__'):261 continue262 # print Materials.__dict__[material_name]263 ray_tracer.create_object(sphere, Materials.__dict__[material_name], (5.5 * (counter - 3.3), 0, 0), 2.4)264 counter += 1265 print counter, material_name266def init():267 write_obj()268 ray_tracer.c_screenWidth, ray_tracer.c_screenHeight = tracer.screen_width, tracer.screen_height269 ray_tracer.c_maxDepth = 4270 ray_tracer.c_numThreads = 8271 ray_tracer.c_ambient_strength = 0.0272 ray_tracer.c_specular_index = 50273 ray_tracer.c_super_sample_threshold = 0.0274 ray_tracer.c_smooth_normal = 1275 ray_tracer.c_fixed_sample = 0276 ray_tracer.initialize()277 ray_tracer.c_viewPortRatio = 2.5278 ray_tracer.move_view_port((0, 0, 40))279def render(sample_rate, show_mat=True, callback=None):280 t = time.time()281 ray_tracer.render(sample_rate, show_mat)282 print 'Render elapsed', time.time() - t283 if callback:284 callback()285sun = 0286def add_table():287 sphere = ray_tracer.create_sphere()288 global sun289 sun = ray_tracer.create_object(sphere, Materials.sun, (-300, 200, -100), 100)290 ray_tracer.create_square_with_picture('sky.jpg', Materials.picture, (0, 400, 0), 3000, (0, -1, 0))291 table = ray_tracer.create_square_with_picture('table2.jpg', Materials.cloth, (-20, -10, -20), 150, (0, 1, 0))292 ray_tracer.move(table, (40, 0, -5))293 mesh = ray_tracer.create_mesh(filename='meshes/Espresso_Cup.obj', compress=1)294 ray_tracer.create_object(mesh, Materials.china, (0, -10, 0), 2.3)295 mesh = ray_tracer.create_mesh(filename='meshes/spoon/spoon.obj', compress=1)296 spoon = ray_tracer.create_object(mesh, Materials.ice, (10, -10.2, 20), .15)297 ray_tracer.rotate(spoon, (0, 0, 1), 0.04)298 ray_tracer.rotate(spoon, (0, 1, 0), 0.2)299 ray_tracer.move(spoon, (1, 0, 0))300 ray_tracer.rotate_view_port((0, 1, 0), 0.5)301 ray_tracer.rotate_view_port((1, 0, 0), 0.3)302 ray_tracer.move_view_port((-11, 0, 0))303 ray_tracer.move_view_port((0, 4, 0))304 ray_tracer.c_color_gamma = 1.0 / 2.2305 ray_tracer.c_apertureRadius = 2.5306 ray_tracer.c_focus = (0, -10, 0)307 ray_tracer.c_viewPortRatio = 7.5308 ray_tracer.move_view_port((-3, 1, 100))309 # sphere = ray_tracer.create_sphere()310 # global sun311 # sun = ray_tracer.create_object(sphere, Materials.sun, (0, 0, 0), 1)312def add_mesh_table():313 sphere = ray_tracer.create_sphere()314 ray_tracer.create_object(sphere, Materials.sun, (-50, 100, -100), 55)315 plane = ray_tracer.create_plane()316 ray_tracer.create_object(plane, Materials.wall, (-1000, 0, 0), 1, (1, 0, 0))317 ray_tracer.create_object(plane, Materials.wall, (1000, 0, 0), 1, (-1, 0, 0))318 ray_tracer.create_object(plane, Materials.wall, (0, 0, -1000), 1, (0, 0, 1))319 # ray_tracer.create_object(plane, Materials.wall, (0, 0, 4000000), 1, (0, 0, -1))320 ray_tracer.create_square_with_picture('sky.jpg', Materials.picture, (0, 400, 0), 3000, (0, -1, 0))321 table = ray_tracer.create_square_with_picture('sea.jpg', Materials.cloth, (20, -10, -20), 150, (0, 1, 0))322 ray_tracer.set_velocity(table, (10, 0, 0))323 ray_tracer.move(table, (-5, 0, -5))324 import random325 for i in range(0):326 # ball = ray_tracer.create_object(sphere, Materials.china, (6, 1 + 2 * random.random(), 6 + 2 * random.random()),327 # 1 * (1.0 + random.random()))328 ball = ray_tracer.create_object(sphere, Materials.silver, (6 + 30 * random.random(), 1 + 10 * random.random(), 4 + 30 * random.random()),329 0.5 * (1.0 + random.random()))330 ray_tracer.set_velocity(ball, (5, 0, 0))331 mesh = ray_tracer.create_mesh(filename='meshes/fixed.perfect.dragon.100K.0.07.obj', compress=1)332 dragon = ray_tracer.create_object(mesh, Materials.red_ice, (6, 0, 6), 14)333# ray_tracer.move(mesh, (6, 0, 6))334 # spoon = ray_tracer.create_object(mesh, Materials.red_ice, (1, 0.3, 12), 14.2)335 # spoon = ray_tracer.create_object(sphere, Materials.red_ice, (0, 0, 0), 4)336 # mesh = ray_tracer.create_mesh(nilename='meshes/fixed.perfect.dragon.100K.0.07.obj')337 # spoon = ray_tracer.create_object(sphere, Materials.blue_ice, (6, 0, 6), 6)338 # ray_tracer.rotate(spoon, (0, 0, 1), 0.04)339 # ray_tracer.rotate(spoon, (0, 1, 0), 0.2)340 ray_tracer.c_global_decay = 0.0341 # exit()342 ray_tracer.rotate_view_port((0, 1, 0), 0.5)343 ray_tracer.rotate_view_port((1, 0, 0), 0.3)344 ray_tracer.move_view_port((-11, 0, 0))345 ray_tracer.move_view_port((0, 4, 0))346 ray_tracer.c_color_gamma = 1.0 / 2.2347 ray_tracer.c_apertureRadius = 0.5348 ray_tracer.c_focus = (1, 7, 11)349 ray_tracer.c_viewPortRatio = 7.5350 ray_tracer.move_view_port((0, 2, 100))351def batch_render_table():352 add_table()353 for t in range(32, 100):354 ray_tracer.move(sun, (4, 0, 0))355 for t in range(100, 300):356 print 'Frame:', t357 for sample_times in [1]:#, 30, 100, 1000]:358 ray_tracer.c_sample_times = sample_times359 if not is_mac():360 render(15)361 else:362 render(5)363 ray_tracer.move(sun, (4, 0, 0))364 # ray_tracer.rotate(sun, (0, 0, 0), 0.5)365def add_solar_system():366 sphere = ray_tracer.create_sphere()367 table = ray_tracer.create_square_with_picture('sky.jpg', Materials.cloth, (-20, -10, -20), 150, (0, 1, 0))368 # table = ray_tracer.create_square_with_picture('table2.jpg', Materials.cloth, (-20, 200, -20), 150, (0, -1, 0))369 global sun370 sun = ray_tracer.create_object(sphere, Materials.sun, (-200, 100, -80), 40)371 ray_tracer.rotate_view_port((0, 1, 0), 0.5)372 ray_tracer.rotate_view_port((1, 0, 0), 0.6)373 ray_tracer.move_view_port((-11, 0, 0))374 ray_tracer.move_view_port((0, 4, 0))375 ray_tracer.c_color_gamma = 1.0 / 2.2376 ray_tracer.c_apertureRadius = 3.5377 ray_tracer.c_focus = (0, -10, 0)378 ray_tracer.c_viewPortRatio = 7.5379 ray_tracer.move_view_port((-3, 1, 100))380 ray_tracer.move_view_port((-3.7, 14, 0))381 ray_tracer.create_object(sphere, Materials.sun_weak, (0, 0, 0), 3)382 planets = []383 planets.append(ray_tracer.create_object(sphere, Materials.silver, (8, 0, 0), 1.5))384 planets.append(ray_tracer.create_object(sphere, Materials.gold, (11, 0, 0), 0.4))385 planets.append(ray_tracer.create_object(sphere, Materials.ice, (14, 0, 0), 1.8))386 planets.append(ray_tracer.create_object(sphere, Materials.green, (18, 0, 0), 0.9))387 return planets388 # planet2 = ray_tracer.create_object(sphere, Materials.china, (0, 0, 0), 3)389 # planet3 = ray_tracer.create_object(sphere, Materials.china, (0, 0, 0), 3)390def batch_render_solar_system():391 planets = add_solar_system()392 print planets393 x = [lambda t:0 for i in range(len(planets))]394 y = [lambda t:0 for i in range(len(planets))]395 x[0] = lambda t: cos(t * 5) * 8396 y[0] = lambda t: sin(t * 5) * 8397 x[1] = lambda t: cos(t) * 14 - cos(3 * t) * 3398 y[1] = lambda t: sin(t) * 14 + sin(3 * t) * 3399 x[2] = lambda t: cos(t) * 14400 y[2] = lambda t: sin(t) * 14401 x[3] = lambda t: cos(t * 2) * 18402 y[3] = lambda t: sin(t * 2) * 18403 last_t = 0...

Full Screen

Full Screen

tests.py

Source:tests.py Github

copy

Full Screen

...60 set(self.get_form_error_fields(response))61 )62 def test_signup_fail_email_exists(self):63 data = self._get_user_data()64 create_object(User, email=data['email'], password=data['password'])65 response = self.testapp.post("/signup/", self._get_user_data())66 self.assertEquals(67 set(['email']), set(self.get_form_error_fields(response))68 )69 def test_signup_fail_invalid_email(self):70 data = self._get_user_data(email='invalid emails')71 response = self.testapp.post("/signup/", data)72 self.assertEquals(73 set(['email']), set(self.get_form_error_fields(response))74 )75 def test_signup_fail_passwords_dont_match(self):76 invalid_data = self._get_user_data(password='another pass')77 response = self.testapp.post("/signup/", invalid_data)78 self.assertEquals(79 set(['confirm_password']),80 set(self.get_form_error_fields(response))81 )82class SigninTestCase(BaseTestCase):83 def _get_user_data(self, **kwargs):84 user_data = {85 'email': 'email@example.com',86 'password': 'secure_password'87 }88 user_data.update(**kwargs)89 return user_data90 def test_signin_success(self):91 data = self._get_user_data()92 create_object(User, **data)93 self.testapp.post("/signin/", data, status=302)94 def test_signin_fail(self):95 response = self.testapp.post(96 '/signin/', self._get_user_data())97 self.assertIn('Wrong email or password', response.body)98 def test_signin_fail_required_fields(self):99 response = self.testapp.post('/signin/', {})100 self.assertEquals(101 set(self._get_user_data().keys()),102 set(self.get_form_error_fields(response))103 )104 def test_signup_fail_invalid_email(self):105 data = self._get_user_data(email='invalid email')106 response = self.testapp.post('/signin/', data)107 self.assertEquals(108 ['email'], self.get_form_error_fields(response))109class PadTestCase(BaseTestCase):110 def test_create_success(self):111 user_data = {'email': 'email@example.com', 'password': 'password'}112 create_object(User, **user_data)113 self.signin(**user_data)114 self.testapp.post('/pads/create/', {'name': 'pad'}, status=302)115 self.assertEquals(1, DBSession.query(Pad).count())116 def test_create_fail_required_name(self):117 user_data = {'email': 'email@example.com', 'password': 'password'}118 create_object(User, **user_data)119 self.signin(**user_data)120 response = self.testapp.post('/pads/create/', {})121 self.assertEquals(122 ['name'], self.get_form_error_fields(response))123 def test_create_fail_anonymous_user(self):124 response = self.testapp.post('/pads/create/', {'name': 'pad'})125 self.assertIn('sign-in', response.html.find('form')['class'])126 self.assertEquals(0, DBSession.query(Pad).count())127 def test_edit_success(self):128 user_data = {'email': 'email@example.com', 'password': 'password'}129 user = create_object(User, **user_data)130 self.signin(**user_data)131 pad = create_object(Pad, name='pad', user=user)132 new_name = 'new pad name'133 self.testapp.post(134 '/pads/{}/edit/'.format(pad.id), {'name': new_name}, status=302)135 self.assertEquals(new_name, DBSession.query(Pad).get(pad.id).name)136 def test_edit_fail_required_name(self):137 user_data = {'email': 'email@example.com', 'password': 'password'}138 create_object(User, **user_data)139 self.signin(**user_data)140 response = self.testapp.post('/pads/create/', {})141 self.assertEquals(142 ['name'], self.get_form_error_fields(response))143 def test_edit_fail_anothers_user(self):144 user_data = {'email': 'email@example.com', 'password': 'password'}145 user = create_object(User, **user_data)146 pad = create_object(Pad, name='pad', user=user)147 another_user_data = {148 'email': 'another@example.com', 'password': 'password'149 }150 create_object(User, **another_user_data)151 self.signin(email='another@example.com', password='password')152 response = self.testapp.post(153 '/pads/{}/edit/'.format(pad.id),154 {'name': 'new name'}, expect_errors=True)155 self.assertEquals(response.status_code, 404)156 def test_delete_success(self):157 user_data = {'email': 'email@example.com', 'password': 'password'}158 user = create_object(User, **user_data)159 pad = create_object(Pad, name='pad', user=user)160 self.signin(**user_data)161 self.testapp.post(162 '/pads/{}/delete/'.format(pad.id),163 {'name': 'new name'}, status=302)164 self.assertEquals(0, DBSession.query(Pad).count())165 def test_delete_fail_anothers_user(self):166 user_data = {'email': 'email@example.com', 'password': 'password'}167 user = create_object(User, **user_data)168 pad = create_object(Pad, name='pad', user=user)169 another_user_data = {170 'email': 'another@example.com', 'password': 'password'171 }172 create_object(User, **another_user_data)173 self.signin(email='another@example.com', password='password')174 response = self.testapp.post(175 '/pads/{}/delete/'.format(pad.id), {}, expect_errors=True)176 self.assertEquals(response.status_code, 404)177class NoteTestCase(BaseTestCase):178 def _get_note_data(self, **kwargs):179 note_data = {180 'name': 'note', 'pad_id': 0, 'text': 'text'181 }182 note_data.update(**kwargs)183 return note_data184 def test_create_success(self):185 user_data = {'email': 'email@example.com', 'password': 'password'}186 create_object(User, **user_data)187 self.signin(**user_data)188 self.testapp.post('/notes/create/', self._get_note_data(), status=302)189 self.assertEquals(1, DBSession.query(Note).count())190 def test_create_fail_required_fields(self):191 user_data = {'email': 'email@example.com', 'password': 'password'}192 create_object(User, **user_data)193 self.signin(**user_data)194 response = self.testapp.post('/notes/create/', {})195 self.assertEquals(196 set(self._get_note_data().keys()),197 set(self.get_form_error_fields(response))198 )199 def test_create_fail_anothers_user_pad(self):200 user_data = {'email': 'email@example.com', 'password': 'password'}201 create_object(User, **user_data)202 another_user = create_object(203 User, email='another@example.com', password='password')204 another_user_pad = create_object(Pad, name='pad', user=another_user)205 self.signin(**user_data)206 response = self.testapp.post(207 '/notes/create/', self._get_note_data(pad_id=another_user_pad.id))208 self.assertEquals(['pad_id'], self.get_form_error_fields(response))209 def test_create_fail_anonymous_user(self):210 response = self.testapp.post('/notes/create/', self._get_note_data())211 self.assertIn('sign-in', response.html.find('form')['class'])212 self.assertEquals(0, DBSession.query(Note).count())213 def test_edit_success(self):214 user_data = {'email': 'email@example.com', 'password': 'password'}215 user = create_object(User, **user_data)216 self.signin(**user_data)217 note = create_object(Note, name='note', text='text', user=user)218 new_name = 'new note name'219 self.testapp.post(220 '/notes/{}/edit/'.format(note.id),221 {'name': new_name, 'pad_id': 0, 'text': 'text'}222 )223 self.assertEquals(new_name, DBSession.query(Note).get(note.id).name)224 def test_edit_fail_required_fields(self):225 user_data = {'email': 'email@example.com', 'password': 'password'}226 user = create_object(User, **user_data)227 self.signin(**user_data)228 note = create_object(Note, name='note', text='text', user=user)229 response = self.testapp.post(230 '/notes/{}/edit/'.format(note.id), {}231 )232 self.assertEquals(233 set(self._get_note_data().keys()),234 set(self.get_form_error_fields(response))235 )236 def test_edit_fail_anothers_user(self):237 user_data = {'email': 'email@example.com', 'password': 'password'}238 user = create_object(User, **user_data)239 note = create_object(Note, name='note', text='text', user=user)240 another_user_data = {241 'email': 'another@example.com', 'password': 'password'242 }243 create_object(User, **another_user_data)244 self.signin(email='another@example.com', password='password')245 response = self.testapp.post(246 '/pads/{}/edit/'.format(note.id),247 {'name': 'new name', 'text': 'text', 'pad_id': 0},248 expect_errors=True)249 self.assertEquals(response.status_code, 404)250 def test_delete_success(self):251 user_data = {'email': 'email@example.com', 'password': 'password'}252 user = create_object(User, **user_data)253 note = create_object(Note, name='note', text='text', user=user)254 self.signin(**user_data)255 self.testapp.post(256 '/notes/{}/delete/'.format(note.id),257 {'name': 'new name'}, status=302)258 self.assertEquals(0, DBSession.query(Note).count())259 def test_delete_fail_anothers_user(self):260 user_data = {'email': 'email@example.com', 'password': 'password'}261 user = create_object(User, **user_data)262 note = create_object(Note, name='note', text='text', user=user)263 another_user_data = {264 'email': 'another@example.com', 'password': 'password'265 }266 create_object(User, **another_user_data)267 self.signin(email='another@example.com', password='password')268 response = self.testapp.post(269 '/pads/{}/delete/'.format(note.id), {}, expect_errors=True)270 self.assertEquals(response.status_code, 404)271def create_object(object_class, **object_data):272 obj = object_class(**object_data)273 DBSession.add(obj)274 DBSession.flush()...

Full Screen

Full Screen

sokorun.py

Source:sokorun.py Github

copy

Full Screen

1#! /usr/bin/env python32from sokoban import sokoban_play3'''4field = create_sokoban_field()5field = sokoban_add(field, create_object('#', 0, 0))6field = sokoban_add(field, create_object('#', 0, 1))7field = sokoban_add(field, create_object('#', 0, 2))8field = sokoban_add(field, create_object('#', 0, 3))9field = sokoban_add(field, create_object('#', 0, 4))10field = sokoban_add(field, create_object('#', 0, 5))11field = sokoban_add(field, create_object('#', 0, 6))12field = sokoban_add(field, create_object('#', 1, 0))13field = sokoban_add(field, create_object('#', 1, 6))14field = sokoban_add(field, create_object('#', 2, 0))15field = sokoban_add(field, create_object('#', 2, 6))16field = sokoban_add(field, create_object('#', 3, 0))17field = sokoban_add(field, create_object('#', 3, 6))18field = sokoban_add(field, create_object('#', 4, 0))19field = sokoban_add(field, create_object('#', 4, 6))20field = sokoban_add(field, create_object('#', 5, 0))21field = sokoban_add(field, create_object('#', 5, 6))22field = sokoban_add(field, create_object('#', 6, 2))23field = sokoban_add(field, create_object('#', 6, 3))24field = sokoban_add(field, create_object('#', 6, 4))25field = sokoban_add(field, create_object('#', 5, 5))26field = sokoban_add(field, create_object('#', 6, 5))27field = sokoban_add(field, create_object('#', 6, 0))28#field = sokoban_add(field, create_object('#', 5, 5)29#field = sokoban_add(field, create_object('#', 5, 5))30field = sokoban_add(field, create_object('@', 3, 5))31field = sokoban_add(field, create_object('O', 3, 4))32field = sokoban_add(field, create_object('.', 3, 3))33field = sokoban_add(field, create_object('.', 3, 2))34field = sokoban_add(field, create_object('.', 3, 1))35'''...

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