コード例 #1
0
def test_SquareArea():
    square1 = shp.Square()
    square1.side_length = 3
    expected = (square1.side_length ** 2)
    desc = "Returns area of square from side length."
    actual = square1.area
    print_test_results(blank, desc, expected, actual)
    print str(square1), '\n'
コード例 #2
0
def test_shapes_s():
    shape_square_test = Shapes.Square()
    shape_square_test.side = 2.0
    desc = ""
    expected = 4.0
    actual = shape_square_test.area()
    print_test_results(test_shapes_s, desc, expected, actual)
    print str(shape_square_test)
コード例 #3
0
def test_find_square_area():
    '''Test length 10'''
    expected = 9
    square = sha.Square()
    square.length = 3
    actual = square.area
    print_test_results(test_find_square_area, expected, actual)
    print str(square)
コード例 #4
0
def test_square_area():
    desc = 'Returns the the area of a square if we know the length of its side'
    square = Shapes.Square()
    side = 3
    square.side = side
    expected = (side)**2
    actual = square.area
    print_test_results(Shapes.Square, desc, expected, actual)
    print str(square) + '\n'
コード例 #5
0
def test_square_area():
    desc = "Return area of a square when given a side length"

    test_square = Shapes.Square()
    test_square.length_of_side = 3
    square_area = test_square.area

    expected = 9
    actual = square_area
    print_test_results(test_square_area, desc, expected, actual)
    print str(test_square)
コード例 #6
0
    GPoint = img.shape[1] // 2 + separationDistance, img.shape[
        0] // 2 - separationDistance
    IPoint = img.shape[1] // 2 + separationDistance, img.shape[
        0] // 2 + separationDistance

    color = 0, 255, 0
    thickness = 2
    squareSize = 15
    '''
    Square locations
    A B C
    D E F
    G H I
    '''

    E = Shapes.Square(img, EPoint, squareSize, color, thickness)
    D = Shapes.Square(img, DPoint, squareSize, color, thickness)
    F = Shapes.Square(img, FPoint, squareSize, color, thickness)
    B = Shapes.Square(img, BPoint, squareSize, color, thickness)
    H = Shapes.Square(img, HPoint, squareSize, color, thickness)
    A = Shapes.Square(img, APoint, squareSize, color, thickness)
    C = Shapes.Square(img, CPoint, squareSize, color, thickness)
    G = Shapes.Square(img, GPoint, squareSize, color, thickness)
    I = Shapes.Square(img, IPoint, squareSize, color, thickness)

    E.display()
    D.display()
    F.display()
    B.display()
    H.display()
    A.display()