def test_example(): expected = 19.63495 circle = sh.Circle() circle.radius = 2.5 actual = round(circle.area, 5) print_test_results(test_example, expected, actual)
def test_circleArea(): circle1 = shp.Circle() circle1.radius = 2.5 expected = (math.pi * circle1.radius**2) desc = "Returns area of circle from radius." actual = circle1.area print_test_results(blank, desc, expected, actual) print str(circle1) , '\n'
def test_shapes_c(): shape_circle_test = Shapes.Circle() shape_circle_test.radius = 2.5 desc = "" expected = 19.63495 actual = shape_circle_test.area() print_test_results(test_shapes_c, desc, expected, actual) print str(shape_circle_test)
def test_find_circle_area(): '''Test radius 2.5''' expected = round(19.6349540849, 5) circle = sha.Circle() circle.radius = 2.5 actual = round(circle.area, 5) print_test_results(test_find_circle_area, expected, actual) print str(circle)
def test_circle_area(): desc = 'Returns the the area of a circle if we know its radius' circle = Shapes.Circle() radius = 2.5 circle.radius = radius expected = math.pi * radius**2 actual = circle.area print_test_results(Shapes.Circle, desc, expected, actual) print str(circle) + '\n'
def test_circle_area(): desc = "Given a radius, return the area of that circle" test_circle = Shapes.Circle() test_circle.radius = 2.5 circle_area = test_circle.area expected = 19.6349540849 actual = circle_area print_test_results(test_circle_area, desc, expected, actual) print str(test_circle)
sample.save(data_path + '/samples/sample' + str(i) + '.png', data_path + '/parameters.txt') else: # to_generate == "f" h = conf['height'] w = conf['width'] obj_shape = conf['object'] obj_color = conf['obj_color'] motion_type = conf['motion_type'] dof = conf['dof'] data_dir = conf['root'] + "Frames_dataset/" + motion_type + '_' + obj_shape + '_' + str(obj_color) + '_' + dof \ + '_' + str(n_samples) if obj_shape == 'point': shape = Shapes.Point(obj_color) else: circle_parameters = conf['circle_parameters'] shape = Shapes.Circle(obj_color, circle_parameters['radius']) data_dir = data_dir + '_' + str(circle_parameters['radius']) data_dir = data_dir + "_" + str(h) + "_" + str(w) check_dirs(data_dir, True) print(data_dir) for i in range(n_samples): if i % 1 == 0 or i == n_samples - 1: print(i) if motion_type == 'URM': if i == 0: header = 'x0 u_x y0 n_points gap motion noise(mean, standard deviation)\n' sample = Frames.URM(noise_parameters, n_points, gap, h, w, shape, dof)
if event.key == pygame.K_RIGHT: player_Block.moveRight(15) direction = 'right' if event.key == pygame.K_UP: player_Block.moveUp(15) direction = 'up' if event.key == pygame.K_DOWN: player_Block.moveDown(15) direction = 'down' if event.key == pygame.K_SPACE: if direction: # direction string is set i.e user has not pressed space before moving to prevent drawing bullet at 0,0 x = Shapes.Circle(0, 0, 0, 0, 10, red) all_sprites_list.add(x) bullet_list.append(x) fire(x, player_Block, direction) if event.type == pygame.KEYUP: if (event.key == pygame.K_LEFT) or (event.key == pygame.K_RIGHT) or (event.key == pygame.K_UP) or (event.key == pygame.K_DOWN): player_Block.stop() ####################### COLLISION DETECTION ############################# for i in bullet_list: moveShape(i)