def test_plot_draws_fig(dummy_data): geodesic = dummy_data cl = InteractiveGeodesicPlotter() cl.plot(geodesic) fig = cl.show() assert cl.attractor_present assert fig
def test_interactive_geod_plotter_draws_parametric_plot(dummy_geod): geod = dummy_geod igpl = InteractiveGeodesicPlotter() igpl.parametric_plot(geod) fig = igpl.show() assert fig
def test_interactive_geod_plotter_show_clear(dummy_geod): geod = dummy_geod igpl = InteractiveGeodesicPlotter(draw_ergosphere=False) igpl.plot(geod) assert isinstance(igpl.show(), Figure) igpl.clear() assert igpl.fig.data == ()
def test_interactive_geod_plotter_parameters(dummy_geod): geod = dummy_geod igpl = InteractiveGeodesicPlotter(bh_colors=("#0F0", "#FAF"), draw_ergosphere=False) assert igpl.bh_colors == ("#0F0", "#FAF") assert igpl.draw_ergosphere is False fig = igpl.show() assert fig
def test_save_saves_plot(mock_save, dummy_data): geodesic = dummy_data cl = InteractiveGeodesicPlotter() cl.plot(geodesic) name = "test_plot.png" cl.save(name) basename, ext = os.path.splitext(name) mock_save.assert_called_with( cl.fig, image=ext[1:], image_filename=basename, show_link=False )
def test_interactive_geod_plotter_saves_plot(mock_save, dummy_geod): geod = dummy_geod igpl = InteractiveGeodesicPlotter() igpl.plot(geod) name = "test_plot.png" igpl.save(name) basename, ext = os.path.splitext(name) mock_save.assert_called_with( igpl.fig, image=ext[1:], image_filename=basename, show_link=False )
def test_interactive_geod_plotter_plot2D_raises_error(dummy_geod): geod = dummy_geod igpl = InteractiveGeodesicPlotter() try: igpl.plot2D(geod, coordinates=(0, 2)) assert False except IndexError: assert True
def test_plot_calls_draw_attractor_AutoScale(dummy_data): geodesic = dummy_data cl = InteractiveGeodesicPlotter() cl.plot(geodesic) assert cl.attractor_present
def test_plot_calls_draw_attractor_Manualscale(dummy_data): geodesic = dummy_data cl = InteractiveGeodesicPlotter(attractor_radius_scale=1500) cl.plot(geodesic) assert cl.attractor_present assert cl.attractor_radius_scale == 1500
def test_interactive_plotter_has_figure(dummy_data): geodesic = dummy_data cl = InteractiveGeodesicPlotter() assert isinstance(cl.fig, Figure) assert cl.attractor_present is False
def test_interactive_geod_plotter_has_figure(dummy_geod): geod = dummy_geod igpl = InteractiveGeodesicPlotter() assert isinstance(igpl.fig, Figure)