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'])
def test_from_polygon(): shape = Shape.circle([0, 0], 1) assert shape == Shape(shape.poly)