Skip to content

Commit

Permalink
made plot div output more meaningful for downstream web content
Browse files Browse the repository at this point in the history
  • Loading branch information
karrmagadgeteer2 committed Oct 29, 2023
1 parent 423a6cc commit 708e050
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1189,19 +1189,29 @@ def test_plot_series_filefolders(self: TestOpenFrame) -> None:
msg = "html file not created"
raise FileNotFoundError(msg)

plotfile.unlink()
if plotfile.exists():
msg = "html file not deleted as intended"
raise FileExistsError(msg)

if figfile[:5] == "<div>":
msg = "plot_series method not working as intended"
raise FileNotFoundError(msg)

_, divstring = plotframe.plot_series(auto_open=False, output_type="div")
filename = "trial.html"
divfile = directory.joinpath(filename)
_, divstring = plotframe.plot_series(
auto_open=False,
output_type="div",
filename=filename,
directory=directory,
)

if divstring[:5] != "<div>" or divstring[-6:] != "</div>":
msg = "Html div section not created"
raise FileNotFoundError(msg)

plotfile.unlink()
if plotfile.exists():
msg = "html file not deleted as intended"
raise FileExistsError(msg)
divfile.unlink()

with patch("pathlib.Path.exists") as mock_userfolderexists:
mock_userfolderexists.return_value = True
Expand Down Expand Up @@ -1305,19 +1315,29 @@ def test_plot_bars_filefolders(self: TestOpenFrame) -> None:
msg = "html file not created"
raise FileNotFoundError(msg)

plotfile.unlink()
if plotfile.exists():
msg = "html file not deleted as intended"
raise FileExistsError(msg)

if figfile[:5] == "<div>":
msg = "plot_bars method not working as intended"
raise FileNotFoundError(msg)

_, divstring = plotframe.plot_bars(auto_open=False, output_type="div")
filename = "trial.html"
divfile = directory.joinpath(filename)
_, divstring = plotframe.plot_bars(
auto_open=False,
output_type="div",
filename=filename,
directory=directory,
)

if divstring[:5] != "<div>" or divstring[-6:] != "</div>":
msg = "Html div section not created"
raise FileNotFoundError(msg)

plotfile.unlink()
if plotfile.exists():
msg = "html file not deleted as intended"
raise FileExistsError(msg)
divfile.unlink()

with patch("pathlib.Path.exists") as mock_userfolderexists:
mock_userfolderexists.return_value = True
Expand Down

0 comments on commit 708e050

Please sign in to comment.