def test_plot_balls(create_newtons_cradle): bld = create_newtons_cradle(5) fig, ax = visualize.default_fig_and_ax() ret = visualize.plot_balls(bld, ax) assert len(ret) == 2 circles, points = ret assert isinstance(circles, visualize.CircleCollection) assert isinstance(points, mpl.collections.PathCollection)
def test_plot_obstacles(): obs = [ billiards.obstacles.Disk((0, 0), 10), billiards.obstacles.InfiniteWall((-1, -20), (1, -20)), ] bld = billiards.Billiard(obstacles=obs) fig, ax = visualize.default_fig_and_ax() artists = visualize.plot_obstacles(bld, ax) assert len(artists) == len(bld.obstacles)
def test_plot_velocities(create_newtons_cradle): bld = create_newtons_cradle(5) fig, ax = visualize.default_fig_and_ax() arrows = visualize.plot_velocities(bld, ax) assert isinstance(arrows, mpl.quiver.Quiver)
def test_default_fig_and_ax(): fig, ax = visualize.default_fig_and_ax() assert isinstance(fig, mpl.figure.Figure) assert isinstance(ax, mpl.axes.Axes)