예제 #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)