Пример #1
0
def test_regular_polygon_from_dict():
    spec = {
        'center': [0, 0],
        'radius': 1,
        'n_vertices': 10,
    }
    assert Shape.from_dict(spec) == Shape.regular_polygon([0, 0], 1, 10)
Пример #2
0
def test_regular_polygon_from_dict():
    spec = {
        'center': [0, 0],
        'radius': 1,
        'n_vertices': 10,
    }
    assert Shape.from_dict(spec) == Shape.regular_polygon([0, 0], 1, 10)
Пример #3
0
def test_from_dict():
    spec = {
        'vertices': [[1, 0], [0, 1], [-1, 0], [0, -1]],
        'color': (120, 50, 12),
        'velocity': np.random.sample(2),
    }
    assert Shape.from_dict(spec) == Shape(spec['vertices'],
                                          color=spec['color'],
                                          velocity=spec['velocity'])
Пример #4
0
def test_from_dict():
    spec = {
        'vertices': [[1, 0],
                     [0, 1],
                     [-1, 0],
                     [0, -1]],
        'color': (120, 50, 12),
        'velocity': np.random.sample(2),
    }
    assert Shape.from_dict(spec) == Shape(spec['vertices'], color=spec['color'], velocity=spec['velocity'])
Пример #5
0
def test_rectangle_from_dict():
    spec = {
        'vertices': [[-1, -1],
                     [1, 1]],
    }
    assert Shape.from_dict(spec) == Shape.rectangle(spec['vertices'])
Пример #6
0
def test_circle_from_dict():
    spec = {
        'center': [0, 0],
        'radius': 1,
    }
    assert Shape.from_dict(spec) == Shape.circle([0, 0], 1)
Пример #7
0
def test_rectangle_from_dict():
    spec = {
        'vertices': [[-1, -1], [1, 1]],
    }
    assert Shape.from_dict(spec) == Shape.rectangle(spec['vertices'])
Пример #8
0
def test_circle_from_dict():
    spec = {
        'center': [0, 0],
        'radius': 1,
    }
    assert Shape.from_dict(spec) == Shape.circle([0, 0], 1)